Problem: Unable to generate add-ins when migrating from older to newer versions of Visual Studio used in ArcMap
On migrating an ArcObjects 10.1 add-in in Visual Studio 2010, to an ArcObjects 10.2.x add-in in Visual Studio 2012, the *.esriAddinx file is not be generated when building the project. This can be confirmed by checking the project's bin folder. Visual Studio 2012 generates the following warning message:
"Unable to create .esriAddin; missing ESRI ArcGIS Add-in SDK component(s)."
The exact same warning message is generated when migrating an ArcObjects 10.3.x add-in in Visual Studio 2013 to an ArcObjects 10.4.x add-in in Visual Studio 2015. The causes are related, but are exact opposites of each other.
For the first case, this issue occurs because the path name for the .targets file of the installed Microsoft Build Engine (MSBuild) in the software development kit (SDK) for Visual Studio 2012 is structured differently than in Visual Studio 2010. The number 11 is not included as the version number for the version being targeted in the path name of the add-in, as can be seen in the XML code of the add-in project file below:
In the latter case of migrating to Visual Studio 2015, the exact opposite situation occurs. The XML code in the add-in project file contains the integer 11, yet it should not be there:
The integer 11 was added for Visual Studio 2012 and Visual Studio 2013, and removed at version 2015.
Solution or Workaround
For the first case of migrating to Visual Studio 2012, edit the XML tags in the project file containing the path ESRI.ArcGIS.AddIns.targets as follows:
- Open the project file in Visual Studio. Right-click the project folder, and click Unload Project.
- Open the project file. Right-click the project folder, and click Edit Project.
- Change all XML tags containing the following path (these occur in three different tags):
C:\Program Files (x86)\MSBuild\Esri\ESRI.ArcGIS.AddIns.targets
C:\Program Files (x86)\MSBuild\Esri\ESRI.ArcGIS.AddIns.11.targets
- Save the project file and close it.
Note: The new path name contains number 11 as the version number.
- Reload the project. Right-click the project folder, and click Reload Project.
Note: For the project to reflect the changes, close and reopen the project file and rebuild the project. The project builds successfully, the warning message does not display any more, and the *.esriAddinx file is generated correctly. The generation of the add-in can be confirmed in the project's bin folder.
In the latter case of migrating to Visual Studio 2015, the exact opposite steps should be taken in step 2 above. Remove the integer 11 from the three XML tags in the project file.
- ArcObjects Help for .Net: Building add-ins for ArcGIS for Desktop
- ArcObjects Help for .Net: Advanced add-in concepts