How to compile an ArcGIS Desktop add-in in Visual Studio 2013

First, I check that Microsoft.VisualStudio.Shell.9.0 was in the GAC, It was not there... :( then I proceed as Juho Vainio in Geonet suggest : Visual Studio Command Prompt --> Run as Administrator --> gacutil /i Microsoft.VisualStudio.Shell.9.0.dll, but it failed because I was not giving the full pat of the dll, so I search for it in the Visual Studio 2008 SDK, and Voila!!! it appear in the GAC enter image description here

but the project still does not compile, so, I chec in the real GAC:

C:\Windows\Microsoft.NET\assembly

and found that the file does not exist neither in the GAC_32, nor GAC_64 folder, moreover, it exists in the folder GAC_MSIL, so....i took the folder C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.Shell.9.0 and copied it to the folders GAC_32 and GAC_64.

Now the project compiles.


Here's an additional answer since I just went through this process with ArcGIS 10.3 and Visual Studio 2015. I'll just paste the reply I posted at https://geonet.esri.com/message/579779#579779. There are several steps, but none of them are too difficult.

First, to get the SDK installed, you need to add a few registry keys so that ArcGIS thinks that you have a supported version of Visual Studio installed.

  1. Add registry string value:

    HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\12.0\InstallDir
    

    (or whatever version the SDK installer is looking for) and set it to:

    C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\
    

    (or whatever version of Visual Studio you are trying to use).

  2. Add registry string value:

    HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\12.0\ShellFolder  
    

    (or whatever version the SDK installer is looking for) and set it to:

    C:\Program Files (x86)\Microsoft Visual Studio 14.0\
    

    (or whatever version of Visual Studio you are trying to use).

Second, if you're working with an existing project created for/with an older version of ArcGIS and Visual Studio and creating an add-in, you may need to edit the project file that builds the add-in to correct part of its build task. More on this at http://support.esri.com/en/knowledgebase/techarticles/detail/45263.

  1. Change

    <Import Project="$(MSBuildExtensionsPath)\ESRI\ESRI.ArcGIS.AddIns.targets" Condition="Exists('$(MSBuildExtensionsPath)\ESRI\ESRI.ArcGIS.AddIns.targets')" />
    

    to

    <Import Project="$(MSBuildExtensionsPath)\ESRI\ESRI.ArcGIS.AddIns.11.targets" Condition="Exists('$(MSBuildExtensionsPath)\ESRI\ESRI.ArcGIS.AddIns.11.targets')" />
    

    and change

    <Warning Text="Unable to create .esriAddin; missing ESRI ArcGIS Add-in SDK component(s)." Condition="!Exists('$(MSBuildExtensionsPath)\ESRI\ESRI.ArcGIS.AddIns.targets')" />
    

    to

    <Warning Text="Unable to create .esriAddin; missing ESRI ArcGIS Add-in SDK component(s)." Condition="!Exists('$(MSBuildExtensionsPath)\ESRI\ESRI.ArcGIS.AddIns.11.targets')" />.
    

    Alternatively, you can copy and rename the existing ESRI.ArcGIS.AddIns.targets file to ESRI.ArcGIS.AddIns.11.targets. The MSBuildExtensionsPath is located in your Program Files (x86) directory.

Third, if you're building an add-in, you need to edit the .targets file from the previous step to look for the version of Visual Studio you are trying to use.

  1. In

    C:\Program Files (x86)\MSBuild\Esri\ESRI.ArcGIS.AddIns.11.targets
    

    change

    <UsingTask AssemblyName="ESRI.ArcGIS.AddIns.SDK.12, Version=10.3.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86" TaskName="PackageAddIn" Condition="'$(VisualStudioVersion)' == '12.0'" />
    <UsingTask AssemblyName="ESRI.ArcGIS.AddIns.SDK.12, Version=10.3.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86" TaskName="ValidateAddInXMLTask" Condition="'$(VisualStudioVersion)' == '12.0'" />
    <UsingTask AssemblyName="ESRI.ArcGIS.AddIns.SDK.12, Version=10.3.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86" TaskName="ConvertToRelativePath" Condition="'$(VisualStudioVersion)' == '12.0'" />
    <UsingTask AssemblyName="ESRI.ArcGIS.AddIns.SDK.12, Version=10.3.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86" TaskName="ResolveAddInReference" Condition="'$(VisualStudioVersion)' == '12.0'" />
    

    to

    <UsingTask AssemblyName="ESRI.ArcGIS.AddIns.SDK.12, Version=10.3.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86" TaskName="PackageAddIn" Condition="'$(VisualStudioVersion)' == '14.0'" />
    <UsingTask AssemblyName="ESRI.ArcGIS.AddIns.SDK.12, Version=10.3.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86" TaskName="ValidateAddInXMLTask" Condition="'$(VisualStudioVersion)' == '14.0'" />
    <UsingTask AssemblyName="ESRI.ArcGIS.AddIns.SDK.12, Version=10.3.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86" TaskName="ConvertToRelativePath" Condition="'$(VisualStudioVersion)' == '14.0'" />
    <UsingTask AssemblyName="ESRI.ArcGIS.AddIns.SDK.12, Version=10.3.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86" TaskName="ResolveAddInReference" Condition="'$(VisualStudioVersion)' == '14.0'" />
    

    Alternatively, you can simply remove the Condition="'$(VisualStudioVersion)' == '12.0'" from these entries.

Fourth and finally, you need a copy of the Visual Studio 2013 shell registered in the GAC. I was able to copy this from another machine (it was located at C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.Shell.12.0), but if you don't have access to a machine with VS2013 installed you can download the Visual Studio 2013 SDK from https://www.microsoft.com/en-us/download/details.aspx?id=40758 and copy it from there.

  1. Find a copy of the Microsoft.VisualStudio.Shell.12.0.dll for Visual Studio 2013 and copy it to your machine. Register it in the GAC using an elevated command prompt by entering gacutil /i Microsoft.VisualStudio.Shell.12.0.dll from the location you copied the file to on your machine. Note that you will now have two versions of this file in the GAC, one from Visual Studio 2013 and one from Visual Studio 2015. This can be seen by entering gacutil /l from the command prompt to list all of the entries in the GAC. My entries look like:

    Microsoft.VisualStudio.Shell.12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
    Microsoft.VisualStudio.Shell.12.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
    

Hope that helps some others.

Shea


These are the steps I followed multiple times to get addins working in versions of visual studio other than 2010, using the 10.2.2 arcobjects sdk. My guess is this would probably work with 10.1 as well.

  1. Install the version of visual studio you wish to use
  2. Install visual studio 2010 and ArcMap 10.2.2 (requirements for arcobjects 10.2.2)
  3. Install ArcObjects SDK (10.2.2 is the version I used)
  4. Install Visual Studio SDK 2010 http://www.microsoft.com/en-us/download/details.aspx?id=2680
  5. Run Visual Studio command prompt as administrator

    a. cd "C:\Program Files (x86)\Microsoft Visual Studio 2010 SDK\VisualStudioIntegration\Common\Assemblies\v2.0"

    b. gacutil /i Microsoft.VisualStudio.Shell.9.0.dll

  6. Build the addin (visual studio must be restarted if you had it open) Success