4

We are developping a C# ArcObjects Class extension assembly. Our development machine was recently updgraded to ArcGIS 10, but when we try to install the assembly on a 9.3.1 machine, we get an R0000 error while registering the assembly with regasm.

Is it possible to deploy on a ArcGIS 9.3.1 machine a component created with ArcGIS 10?

Edit: We also develop a c++ ArcObjects library and we have no trouble deploying to a 9.3.1 machine Edit2: In our .NET project, the ArcGIS Assembly references where explicitly set to Version Specific : false Edit3: I learned that setting an Assembly reference to Version Specific : false is only relevant to the development environment. It has nothing to do with which assembly is loaded at runtime.

2 Answers 2

7

After doing some research, I found a solution and it's called Assembly Binding Redirection

Basically, for any .net .exe, you can add XML code in the application config file to redirect a referenced assembly from a version number to another.

Esri implemented this in 10.0 and up versions in their EsriRegasm.exe utility. (located here : %commonprogramfiles(x86)%\ArcGIS\bin\esriRegasm.exe or %commonprogramfiles%\ArcGIS\bin\esriRegasm.exe)

If we take a look at 10.1 esriRegasm's configuration file (esriRegasm.exe.config), you see these lines :

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

It means that they are redirecting all references of ESRI.ArcGIS.Carto from 9.3 to 10.0 to the current assembly (10.1.0.0) so you will avoir errors

In my case, the target version is ArcGIS 9.3.1, and there's no EsriRegasm utility. I found a solution on microsoft connect site. Add, for each referenced assembly, this xml code to .NET's RegAsm.exe.config file

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

As stated in the microsoft connect artcile : You can copy regasm.exe + regasm.exe.config to a separate directory to avoid impacting all regasm invocations on the machine.

The bottom word is yes, it's possible, but the easier solution is probably to build our assemblies on a development machine with 9.3.1 installed.

I hope this helps someone

EDIT: In order to make it work in ArcMap.exe or ArcCatalog.exe, you have add the same xml code we put on regasm.exe.config in ArcMap or ArcCatalog's config file.

5
  • +1 How thoroughly have you tested this? Commented Jun 29, 2012 at 0:54
  • Yesterday I was able to register the assembly. This morning I was able to use my 10.1 assembly directly in ArcMap 9.3.1. I edited my post to add a step in order to make it work
    – Goldorak84
    Commented Jun 29, 2012 at 13:07
  • Interesting, I've always thought that assembly redirection is applicable for redirecting to a higher version only.
    – Petr Krebs
    Commented Jun 29, 2012 at 22:11
  • One important note though: this will break any other installed ArcMap/ArcCatalog extensions (addins etc.) which rely on the newer version (> 9.3.0.1770) of the interop assemblies being present. They will be redirected to the older version as well, which might not include certain interfaces necessary for these extensions to work.
    – Petr Krebs
    Commented Jun 29, 2012 at 22:18
  • I shouldn't break other extensions since there is only one ArcMap installation permitted in a local workstation. The "newVersion" field must reflect the local workstation's ArcMap version.
    – Goldorak84
    Commented Jul 3, 2012 at 14:56
1

I would say it is not recommended, since many of the arcobject namespaces have changed from 9.3.1 to 10 (e.g. ESRI.ArcGIS.ADF changed to ESRI.ArcGIS.ADF.Local).

Also, AddIn files are not even recognized on a 9.3.1 machine.

1
  • I know we are limited to objects and interfaces present in the 9.3.1 Assembly. This is not a problem for us and this works with the c++ part of our extension
    – Goldorak84
    Commented Jun 28, 2012 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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