Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

[.netcore 2 preview 2] ifileprovider + di error #6479

Closed
@AerisG222

Description

@AerisG222

After upgrading to the latest preview release, I am now seeing the following error when starting up the application (via dotnet run):

System.InvalidOperationException: Unable to activate type 'Microsoft.AspNetCore.Mvc.Razor.Internal.FileProviderRazorProject'. The following constructors are ambigious:
Void .ctor(Microsoft.AspNetCore.Mvc.Razor.Internal.IRazorViewEngineFileProviderAccessor)
Void .ctor(Microsoft.Extensions.FileProviders.IFileProvider)

My application registers its own IFileProvider as part of startup, like this (also suggested here: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/file-providers):

.AddSingleton(x => new PhysicalFileProvider(_config["Environment:AssetsPath"]))

If I comment out this line, then everything starts normally, but of course the functionality depending on this does not work.

Should this still work as before?

-- dotnet info:
.NET Command Line Tools (2.0.0-preview2-006497)

Product Information:
Version: 2.0.0-preview2-006497
Commit SHA-1 hash: 06a2093335

Runtime Environment:
OS Name: fedora
OS Version: 25
OS Platform: Linux
RID: fedora.25-x64
Base Path: /opt/dotnet/sdk/2.0.0-preview2-006497/

Microsoft .NET Core Shared Framework Host

Version : 2.0.0-preview2-25407-01
Build : 40c565230930ead58a50719c0ec799df77bddee9

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    close