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?
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.
clean the solution and rebuild it . if not worked create new project then copy dll and paste . good luck .
Have you included the
Microsoft.CSharp.dll
reference? Expand your project, right click onReferences
, clickAdd Reference
, searchMicrosoft.CSharp
, check the box, clickOK
.I upgraded the application to dotnet core 2.0 and razor pages and got around the issue.
I had
<DependsOnNETStandard>true</DependsOnNETStandard>
and I had to change it to<DependsOnNETStandard>netstandard1.6</DependsOnNETStandard>
Source: From neman on GitHub Isue
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: