无法加载文件或程序集 'Microsoft.Build.Framework,版本=15.1.0.0,文化=中性,PublicKeyToken = b03f5f7f11d50a3a'。

3

我正在尝试运行控制台应用程序 VS 2017,该应用程序以前是在 VS2015 上构建的,并在 2017 中打开,结果出现了构建错误。

我尝试了谷歌上不同的解决方案,但都失败了。请帮帮我。

    Severity    Code    Description Project File    Line    Suppression State
Error       Fody: An unhandled exception occurred:
Exception:
Could not load file or assembly 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
StackTrace:

Server stack trace: 
   at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
   at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
   at System.Reflection.RuntimeMethodInfo.GetParameters()
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at IInnerWeaver.set_Logger(ILogger value)
   at Processor.ExecuteInOwnAppDomain() in c:\ConsoleBuildAgent\work\ed448661dbb30d2e\Fody\Processor.cs:line 146
   at Processor.Inner() in c:\ConsoleBuildAgent\work\ed448661dbb30d2e\Fody\Processor.cs:line 93
   at Processor.Execute() in c:\ConsoleBuildAgent\work\ed448661dbb30d2e\Fody\Processor.cs:line 45
Source:
mscorlib
TargetSite:
Void GetSignature(Void*, Int32, System.RuntimeFieldHandleInternal, System.IRuntimeMethodInfo, System.RuntimeType)
Could not load file or assembly 'Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

可能会有所帮助 - https://dev59.com/yJ7ha4cB1Zd3GeqPeBZK - Prany
这也是一样的 - https://dev59.com/gFcQ5IYBdhLWcg3wFf8- - SuperOli
2个回答

3
这个解决方案对我有用。微软依赖项中似乎存在版本冲突。问题已消失,现在可以成功构建了。
Azure Build PipelineNuGet tool installer 步骤中,将 Version of NuGet.exe to install 更改为更新的版本,例如 5.4.0
请查看Nuget的 ReleasedAndBlessed 版本,网址为 https://dist.nuget.org/tools.json

适用于我,需要升级到新版本。 - Nick Juelich

0

我也遇到了同样的错误。问题出在这两个包上:Fody 和 Costura.Fody。 对我来说,解决方法是删除 "packages" 文件夹,然后进行还原并更新 nuget 包。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接