Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

My development environment is Visual studio 2010 with ArcGIS Desktop 10.1 installed. I need my add-in to support 10.0 AND 10.1. Right now, if I try to install it on ArcMap 10.0, it fails.

Is it possible to target an ArcMap add-in to an earlier version?

share|improve this question
    
Have your tried setting the .NET Framework to 3.5? 4.0 is default for v10.1. –  artwork21 Jan 10 '13 at 14:01
    
Yes I did, without success –  Goldorak84 Jan 10 '13 at 18:08
add comment

3 Answers

up vote 2 down vote accepted

It's possible to make it work with ArcMap 10.0, but it's not easy and deployment-friendly

First, in your visual studio project, set your target framework to .NET Framework 3.5.

Then, edit the Config.esriaddinx file and modify the "Targets" section to add compatibility with ArcGIS Desktop 10.0, like this:

  <Targets>
    <Target name="Desktop" version="10.0" />
    <Target name="Desktop" version="10.1" />
  </Targets>

Finally, as described in an older post, you have to alter the ArcMap.exe.config by adding the following line inside each "dependentAssembly" block

<bindingRedirect oldVersion="10.1.0.0" newVersion="10.0.0.0"/>

Once modified, it should look like this

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="ESRI.ArcGIS.ADF" culture="" publicKeyToken="8fc3cc631e44ad86"/>
        <bindingRedirect oldVersion="9.3.0.0-9.3.2.0" newVersion="10.0.0.0"/>
        <bindingRedirect oldVersion="10.1.0.0" newVersion="10.0.0.0"/>
      </dependentAssembly>
    </assemblyBinding>

I came to the conclusion that even if it's possible, I'm better off compiling with the lowest version of ArcMap I'm willing to support.

EDIT: See also Rich Wawrzonek's post for an alternative (not recommended by ESRI)

EDIT2: According to Esri, the best way is set up a virtual machine with 10.0 installed on it (see this post)

share|improve this answer
    
Did you make sure SpecificVersion is set to False on each of your ESRI assembly references? –  blah238 Jan 10 '13 at 18:51
    
As stated there(stackoverflow.com/questions/1232842/…) Specific version is only relevant at build-time. At runtime, assemblyBinding is used –  Goldorak84 Jan 10 '13 at 19:03
    
Before writing this post, I tested all of this with a 10.1 development environment and a 10.0 deployment machine –  Goldorak84 Jan 10 '13 at 19:21
add comment

In Config.esriaddinx, try adding a line for 10.0 under Targets, e.g:

  <Targets>
    <Target name="Desktop" version="10.0" />
    <Target name="Desktop" version="10.1" />
  </Targets>

Possibly remove the 10.1 line if that doesn't work -- according to this post, Add-ins targeting version 10.0 should open under 10.1, 10.2, etc.

Also, on the next line, check that language is set to CLR (not CLR-4.0 or whatever the default is at 10.1), and the .NET framework version targeted is 3.5.

share|improve this answer
    
without the binding redirection (see my answer), it doesn't work. When you press the button, ArcMap will try to load the 10.1 assemblies and it will crash –  Goldorak84 Jan 10 '13 at 18:54
add comment

Do you have access to the DotNet folder from the 10.0 install? It is typically located here: C:\Program Files (x86)\ArcGIS\DeveloperKit10.0\DotNet

If yes, then copy that folder to your 10.1 development machine. Name it something like DotNet_10.0_Sp3 or whichever version it is. Then in your Visual Studio Add-in project point your Reference Paths property to this folder. In C# there is a tab called Reference Paths in the project properties where you can add this folder. For VB.net there is a References tab then you need to click on the "Reference Paths.." button.

As noted in other answers: All the ArcGIS references in your project should have 'Specific Version' property set to false. You must also set the Config.esriaddinx file to target 10.0. You may get a warning when you build that it targets previous version but don't update the references. Also, make sure project is set to x86 and .NET 3.5.

This way you have the latest version of ArcGIS on your Dev machine and still be able to build for previous versions.

share|improve this answer
    
This post seems to confirm this work. Have not tried myself. –  blah238 Jan 10 '13 at 19:51
    
In this case, specific version should be set to "true" to make sure your development machine to use the 10.0 version of the assembly. SpecificVersion is a compile-time property. It's not related to the assemblies to load at runtime –  Goldorak84 Jan 10 '13 at 20:17
    
It works when the specific version is set to false. Are you attempting to deploy an add-in that functions differently in 10.0 and 10.1? If not then build for the lower version references using this method. If yes then clarify your question. –  Rich Wawrzonek Jan 10 '13 at 20:45
    
See this post (stackoverflow.com/questions/1063459/…) on specific version. –  Goldorak84 Jan 11 '13 at 12:56
1  
Your comment seems to imply that Esri recommends against my method but they simply lack an opinion on it. Please link to where they comment on this if i'm mistaken. In the blog post above they recommend using a VM which is perfectly acceptable but may require a second license for all the software you need to install in the VM that goes with your deployment and has other drawbacks. –  Rich Wawrzonek Jan 11 '13 at 19:00
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.