dotnet core : Can not find assembly file Microsoft.CSharp.dll

I have a project that i have not run for some while, build with dotnet core 1.1.2 dependencies.

in the meanwhile I have updated visual studio, possible installed some dotnet core stuff for 2.0 and my application do not run anymore.

InvalidOperationException: Can not find assembly file Microsoft.CSharp.dll at 'C:devEarthMLEarthML.MapifysrcEarthML.Mapify.PortalbinDebugnet462win10-x64refs,C:devEarthMLEarthML.MapifysrcEarthML.Mapify.PortalbinDebugnet462win10-x64'
Microsoft.Extensions.DependencyModel.Resolution.AppBaseCompilationAssemblyResolver.TryResolveAssemblyPaths(CompilationLibrary library, List<string> assemblies)

What would I do to start figuring out why it dont work?


This seems to be a bug with the current version of Visual Studio (15.3). The underlying problem is when the Views are trying to build, they are not referencing the GAC, and thus, have none of their dependencies.

While only a work-around, your best bet when encountering this problem is to copy over the missing DLLs. I set them up as components in my project with a copy action. Once it gets fixed (currently Triaged: https://developercommunity.visualstudio.com/content/problem/96927/runtime-error-after-upgrading-to-vs-153-invalidope.html), then it's a matter of deleting them.

EDIT

Alternately, according to https://github.com/dotnet/sdk/issues/1488, adding this as a reference to the project should work instead of adding all the dependencies:

<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.0.0" />

Have you included the Microsoft.CSharp.dll reference? Expand your project, right click on References , click Add Reference , search Microsoft.CSharp , check the box, click OK .

选择Microsoft.CSharp


我将应用程序升级到了dotnet core 2.0和剃须刀页面,并解决了这个问题。

链接地址: http://www.djcxy.com/p/96974.html

上一篇: 如何在IntelliJ中运行Play Framework 2.1项目?

下一篇: dotnet核心:无法找到程序集文件Microsoft.CSharp.dll