[GIS] When converting legacy addins to VS 2010 (ArcGIS 10.1), why are references to certain ArcObjects updated while others are not

arcgis-10.1arcobjectsvisual studio

I am converting a number of my addins from VS 2008 Express, ArcGIS 10.0 to VS 2010, ArcGIS 10.1 and I need to update some but not all references. Why? For example, in the current addin I just converted to VS 2010, Why would references to ESRI.ArcGIS.System,ESRI.ArcGIS.Framework, ESRI.ArcGIS.Desktop.AddIns, ESRI.ArcGIS.ArcMapUI be updated automatically while references to ESRI.ArcGIS.Carto, ESRI.ArcGIS.Geodatabase, ESRI.ArcGIS.Geometry were not.

Until I remove references to ArcObjects version 10.0 and add the appropriate reference to version 10.1 I am getting errors such as: The project currently contains references to more than one version of ESRI.ArcGIS.Carto, a direct reference to version 10.0.0.0 and an indirect reference (through 'ESRI.ArcGIS.ArcMapUI.IMxDocument.SelectedLayer') to version 10.1.0.0. Change the direct reference to use version 10.1.0.0 (or higher) of ESRI.ArcGIS.Carto.

Would removing ArcObjects 10.0 (DeveloperKit10.0 directory) from the machine correct this issue? Should these even be on the machine after using ArcGIS 10 program remover prior to ArcGIS 10.1 installation? If I can remove these, what is the correct procedure?

Best Answer

When you set up a reference to an assembly, you have the option for "Specific Version". When you add a reference manually, by default it is True. The references added by Esri's SDK tools set it to False.

You should be able to highlight multiple references in the Solution Explorer and change multiple assembly references' Specific Version to False. (At least this works in VS2010 Professional). You can also fix by editing the .csproj file:

<Reference Include="ESRI.ArcGIS.ArcMapUI, Version=10.1.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
Related Question