Sunday, August 23, 2015

Migrating ArcGIS 9.3.x Desktop custom components to ArcGIS 10.x using .Net

  
     Migrating ArcGIS 9.3.x Desktop custom 
components to ArcGIS 10.x
   

                              Prepared by – Ravisankara Kumar
                             Sr.Software Engineer – GIS

Summary

This topic explains what's required to migrate custom components from ArcGIS 9.3.x to 
ArcGIS 10.x. Custom components created in 9.3.x require a recompile against the 10.x 
assemblies.

Before you can migrate ArcGIS 9.3 makes sure that

  1.       ArcGIS 10.x for Desktop (Basic, Standard, or Advanced) must be installed.
  2.     .     Make sure Visual Studio 2010 is installed on your machine. To build .NET applications       with ArcGIS for Desktop, the Microsoft .NET Framework 3.5.1 is required.
  3.      Must have the ArcObjects .NET SDK installed to develop .NET-based custom         components.
For ArcGIS Desktop custom components created using Visual Studio 2008, need to open the  projects in Visual Studio 2010 and run the Microsoft upgrade wizard.

To change the location of the external program, right-click the project and select properties.              In the project properties, select Debug and change the external program path to its new location.   The following screen shot shows the default setting of the Start external program option in      ArcGIS 10.x:



Starting at ArcGIS 10.x, the functionality of the ESRI.ArcGIS.ADF assembly was split into    multiple assemblies to separate development tasks performed by ArcGIS Server from ArcGIS Engine and ArcGIS for Desktop developers. To allow custom components that use this assembly created in ArcGIS 9.3.x to work in the 10.x architecture, perform the following steps:

·         Remove the reference to the original ESRI.ArcGIS.ADF assembly.
·         Add a reference to the ESRI.ArcGIS.ADF.Local assembly.



To have a successful compile of a migrated ArcGIS 9.3.x Visual Studio development project,  confirm that all Esri assemblies have the Specific Version property set to false.

Visual Studio automatically uses the new version of the assembly to compile. To do this,           follow these steps:
·         Select an Esri assembly in the Visual Studio Solution Explorer. Right-click the assembly and       select Properties. The Properties dialog box appears.
·         Set the Specific Version property to False as shown in the following screen shot:

Updating component category registration (9.3.x only)

Starting at ArcGIS 10, ArcGIS applications no longer read components from the registry.        Custom components still need to be registered as all COM components do; however, ArcGIS       now uses Extensible Markup Language (XML) tables to store component associations instead.     This more flexible and efficient pattern allows ArcGIS to map component activations to the     version appropriate application.

To properly register your custom component with ArcGIS, registration should be done using           the Esri-provided ESRIRegAsm.exe utility. This utility replaces the standard Microsoft     RegAsm.exe and RegSvr32.exe utilities. Call ESRIRegAsm.exe directly, supplying the      appropriate product target as an argument To use the ESRIRegAsm utility to register your      ArcGIS for Desktop custom components at compile time (to more easily debug and test your components),


Follow these steps:
1.     In Visual Studio, right-click the project name in the Solution Explorer and select       Unload Project as shown in the following screen shot:

2.     Right-click the project name in the Solution Explorer and select Edit <project name>                   as shown in the following screen shot:
3.    Add the following MSBuild code to your project. Place the code at the bottom of your           project file above the closing project tag.
[XML]
<Target Name="BeforeClean">
  <Exec
    WorkingDirectory="$(CommonProgramFiles)\ArcGIS\bin"
    Command="esriRegasm.exe &quot;$(TargetPath)&quot; /p:Desktop /u /s"
    Condition="Exists('$(TargetPath)')"/>
</Target>
<Target Name="AfterBuild">
  <Exec
    WorkingDirectory="$(CommonProgramFiles)\ArcGIS\bin"
    Command="esriRegasm.exe &quot;$(TargetPath)&quot; /p:Desktop /s"/>
</Target>
See the following screen shot that shows the code in the project file:

4.    Right-click the project name in the Solution Explorer, select Reload Project, then save the   project.

5.       Build and run the project to debug your application.

Good Luck :)

No comments:

Post a Comment