Error on using custom build task in Microsoft Build Framework

848 Views Asked by At

I have implemented a custom BuildTask and set the build engine in it. But while executing the code, I am getting this exception

Method not found: 'Void Microsoft.Build.Utilities.Task.set_BuildEngine(Microsoft
.Build.Framework.IBuildEngine)'.

What can be possible cause of this?

2

There are 2 best solutions below

0
On

For me, the problem started when I upgraded the build project to use Visual Studio 2015. The build task that was being tested was referencing the Microsoft.Build.Framework that was installed into the GAC (4.0.0.0.). I had to set the HintPath to use the MSBuild 14 version of the Microsoft.Build.Framework on the assembly that was being tested as well as the test assembly and that fixed the problem.

0
On

You may be using two different versions of the Microsoft Build Framework (Microsoft.Build.Framework). Check the version numbers in the item properties to make sure they're not different (e.g. my issue - Version 4.0.0.0 and Version 14.0.0.0)