Thursday, July 2, 2015

Building ArcMap’s Add-in using command line

Couple of days I have been spending on creating a build automation for ArcMap’s Add-in using Jenkins . In order to accomplish that I need to able to build my visual studio add-in solution using MSBuild.exe.

When I try to build the solution using via command line –
msbuild.exe MyArcMapAddin.sln /t:Clean,Build

The console throws the following error- 
(PrePackageArcGISAddIn target) -> 
  C:\Program Files (x86)\MSBuild\ESRI\ESRI.ArcGIS.AddIns.targets(37,5): error MSB4062: The "ValidateAddInXMLTask" task could not be loaded from the assembly ESRI.ArcGIS.AddIns.SDK, Version=, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86. Could not load file or assembly 'Microsoft.VisualStudio.Shell.9.0, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [SOLVED]
I have tried to fixed error as described in but no luck. However the thread helped me to figure out the root of the error , which is  file (C:\Program Files (x86)\MSBuild\ESRI\ESRI.ArcGIS.AddIns.targets). Then, I removed the file the project compiles and builds but did not create the .esriAddin.

Then I decided to build the project using devenv.exe instead of msbuild.exe.

Again try to build the solution using via command line –

"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" MyArcMapAddin.sln /rebuild "Release"

Voila it worked, without any complains and errors. I still don’t know what’s wrong with msbuild.exe but devene.exe became a rock star so far.

For Jenkins:  Execute Windows batch command -

"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\" TEUI.Addin.sln /rebuild "Release"                  (Change .exe to .com for Jenkins)

Please let me know if this works for you guys – I am curious to see if there are other issues.

Add-in , ArcGIS , ArcMap , MS Visual Studio


Post a Comment


© 2011 GIS and Remote Sensing Tools, Tips and more .. ToS | Privacy Policy | Sitemap

About Me