English

Error: Building Add-in Project using MSBUILD command line causes error MSB4036

Error Message

Building an add-in project using the MSBUILD command line causes error MSB4036: The "ValidateAddInXMLTask" task was not found. The error message similar to the following is returned:

"Project "C:\MSBuildTest\ArcMapAddin1\ArcMapAddin1\ArcMapAddin1.vbproj" on node 1 (default targets).
C:\Program Files (x86)\MSBuild\ESRI\ESRI.ArcGIS.AddIns.targets(42,5): error MSB4036: The "ValidateAddInXMLTask" task was not found.
Check the following:
1.) The name of the task in the project file is the same as the name of the task class.
2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface.
3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Program Files (x86)\MSBuild\12.0\bin" directory.
[C:\MSBuildTest\ArcMapAddin1\ArcMapAddin1\ArcMapAddin1.vbproj]
Done Building Project "C:\MSBuildTest\ArcMapAddin1\ArcMapAddin1\ArcMapAddin1.vbproj" (default targets) -- FAILED."

Cause

This can occur when building an add-in using the wrong version of MSBUILD.exe.

The ArcObjects SDK 10.4 for .NET is supported on Visual Studio 2013 or Visual Studio 2015, consequently the MSBUILD program for those versions of Visual Studio has to be used for any command line build. Because there can be multiple versions of the MSBUILD executable available, it is possible to run a MSBUILD executable that is not associated with a supported Visual Studio version. Trying to build an add-in project with the wrong MSBUILD executable causes this error.

Solution or Workaround

To build ArcObjects SDK 10.4 for .NET add-in projects from the command line, the MSBUILD command that is provided by the respective Visual Studio version must be used. To find the proper path, check the following registry path:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\

This registry path contains a folder 12.0 for Visual Studio 2013 (or 14.0 for Visual Studio 2015).

This folder also shows the location of the correct MSBUILD executable under MSBuildOverrideTasksPath key:
[O-Image]
For example, if using the ArcObjects .NET SDK with Visual Studio 2013, the proper working MSBUILD executable indicated by the MSBuildOverrideTasksPath is:

C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe


Note:
The command must be run from a Visual Studio 2013 developer command prompt:

Code:
>"C:\Program Files (x86)\MSBuild\12.0\bin\msbuild" ArcMapAddin1.vbproj