3

I am trying to running console application VS 2017 previously application built on VS2015 and opened in 2017 and it is started giving build error.

I tried different solutions from google. Nothing working out. Please help me out.

    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.
Swoogan
  • 5,298
  • 5
  • 35
  • 47
James123
  • 11,184
  • 66
  • 189
  • 343
  • might help - https://stackoverflow.com/questions/41582142/visual-studio-2017-msbuild-task-development – Prany Jun 26 '18 at 15:51
  • This as well - https://stackoverflow.com/questions/43330915/could-not-load-file-or-assembly-microsoft-build-frameworkvs-2017 – SuperOli Jun 26 '18 at 15:52

2 Answers2

3

This solution worked for me. There seemed to be a version conflict in the Microsoft dependency. Issue disappeared and now builds successfully.

In the Azure Build Pipeline > NuGet tool installer step, change Version of NuGet.exe to install to a newer version, like 5.4.0.

Check Nuget's ReleasedAndBlessed versions at https://dist.nuget.org/tools.json.

Alfred Wallace
  • 1,741
  • 1
  • 14
  • 32
0

I came into the very same error. The problem were those two packages: Fody and Costura.Fody. The fix for me came after hours and was to Delete the folder "packages" and to do a Restore and update the nuget packages after that.

Ahmed Ahmedov
  • 592
  • 12
  • 29