.NET 5.0控制台项目运行时报错:"An assembly specified in the a

2020-10-21 14:34发布

问题:

一个 .NET 5.0 控制台项目引用了一个类库项目,TargetFramework 都是 net5.0 ,build 成功,但运行时总是报错:

An assembly specified in the application dependencies manifest (Cnblogs.Demo.Console.deps.json) was not found:
package: 'Cnblogs.Demo.Core', version: '1.0.0'
path: 'Cnblogs.Demo.Core.dll'

请问如何解决?

回答1:

是引用 nuget 包 Fody 引起的,删除该引用后就正常了

<PackageReference Include="Fody" Version="6.3.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>


回答2:

删除 bin/Debug/net5.0/<projectName>.deps.json 试试



回答3:

https://blog.csdn.net/lihongzhai/article/details/79039160



标签: .net c#