我有一个项目,我已经有一段时间没有运行了,它使用 dotnet core 1.1.2 依赖项构建。
与此同时,我更新了 visual studio,可能为 2.0 安装了一些 dotnet 核心内容,我的应用程序不再运行。
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)
我该怎么做才能开始弄清楚为什么它不起作用?
最佳答案
这似乎是当前版本的 Visual Studio (15.3) 的错误。潜在的问题是当 View 试图构建时,它们没有引用 GAC,因此没有它们的依赖性。
虽然只是一种变通方法,但遇到此问题时最好的办法是复制丢失的 DLL。我通过复制操作将它们设置为项目中的组件。一旦它得到修复(当前分类:https://developercommunity.visualstudio.com/content/problem/96927/runtime-error-after-upgrading-to-vs-153-invalidope.html),然后就是删除它们的问题。
编辑
或者,根据 https://github.com/dotnet/sdk/issues/1488 ,将其添加为对项目的引用应该可以工作,而不是添加所有依赖项:
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.0.0" />
关于c# - dotnet 核心 : Can not find assembly file Microsoft. CSharp.dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45380712/