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

Viewed 10216

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:\dev\EarthML\EarthML.Mapify\src\EarthML.Mapify.Portal\bin\Debug\net462\win10-x64\refs,C:\dev\EarthML\EarthML.Mapify\src\EarthML.Mapify.Portal\bin\Debug\net462\win10-x64\'
Microsoft.Extensions.DependencyModel.Resolution.AppBaseCompilationAssemblyResolver.TryResolveAssemblyPaths(CompilationLibrary library, List<string> assemblies)

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

7 Answers

I had <DependsOnNETStandard>true</DependsOnNETStandard> and I had to change it to <DependsOnNETStandard>netstandard1.6</DependsOnNETStandard>

<PropertyGroup>
    <TargetFramework>net462</TargetFramework>
    <RuntimeIdentifier>win7-x64</RuntimeIdentifier>
    <IsServiceFabricServiceProject>True</IsServiceFabricServiceProject>
    <AssemblyName>MyProject</AssemblyName>
    <Platforms>AnyCPU;x64</Platforms>
    <DependsOnNETStandard>netstandard1.6</DependsOnNETStandard>
</PropertyGroup>

Source: From neman on GitHub Isue

In my C# project, a few .NET Standard classlib's support a Core console application and a Winforms .net 4.7 program. Yesterday I opened my project, one of the .NET standard dll's gave above error, leaving references with an exclamation mark, same for all libs that depend on it in the solution ! It looked very alarming.

I kept working on my solution, though.. I use Visual Studio 15.8.1 here, the issue seems to be a spook. A fake warning. The exclamation marks remain while working on the project, but nothing happens, it does not disturb anything or interrupt rebuilds. The assembly runs as expected.

Few minutes ago I solved it, by removing the Microsoft.CSharp reference, then rebuild all. It was in only one library, so the rebuild solved all exclamation marks in the solution. The reference has gone away, clear sky.

Related