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?
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
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" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With