You are on page 1of 9

Desktop Development Changes

in ArcGIS 10
a new perspective

July 2010

This technical article describes and explains the changes in the various desktop SDKs at ArcGIS 10 that will impact software development. It doesnt focus on the new features of the APIs but provides key information of the lower level changes to help software implementation.

Architectural changes
Autonomous Nature At version 10 ArcGIS Desktop and ArcGIS Engine can be installed independently. This means that customisation must target either Desktop or Engine. In addition, ESRI have also started to prepare for side by side installation where the ArcGIS product will be installed to an ArcGIS 10 specified folder. On deployment this is completed with a new tool: ESRIRegasm.exe - this takes the place of Regasm.exe (for .NET) and allows you to target the product and version of ArcGIS. Please note, that will these structural changes are in place side by side installs of different core product versions is not yet possible. Policy files removed Due to the separation changes between ArcGIS Desktop and Engine the policy files that were installed into the Global Assembly Cache are no longer installed. These allowed customizations that targeted lower version of ArcGIS Desktop work with newer versions; the policy files redirected calls to previous ArcObjects assemblies to the newer versions. This means that all existing .Net customizations must be recompiled for this release. Note: It is not yet clear whether services packs or future versions of ArcGIS Desktop will require recompiling of Custom Components/Extensions. Add-Ins ESRI has introduced the concept of Add-Ins. Add-Ins are similar to ArcGIS Extensions and Custom commands and tools but they allow registration of these customizations by file as opposed to registry settings. This means that they are easier to deploy. At this release they have not replaced the existing methodology of COM component registration. Therefore, existing .NET extensions and customizations can be migrated to ArcGIS 10. Add-Ins can be authored by .NET or Java along with XML. The XML describes the customization whereas the .NET or Java classes provide the custom behaviour. The SDK includes wizards that integrate with Visual Studio (all versions including free express editions) and Eclipse to aid development.

There is full interactivity between Add-Ins and components created by the traditional COM methods. The Add-In component has an ID value which is used instead of the GUID or ProgIDs in the COM based components. Note: Although deployment of these Add-Ins are non trivial when using xcopy to distribute the customizations, distributing them by Installation script is not. The utility that ESRI recommend to register the files with the application works on a per-user basis, as such an alternative methodology is required for producing "product" based deliverables. COM As stated above COM registration can still be used in extended ArcObjects. The difference in this release is the COM registration and Category Registration is completed by using the utility ESRIRegasm.exe. For existing custom extensions/ components see details below for migration. When creating new components in the Visual Studio IDE and when using the templates provided (e.g. the ArcGIS Project template) the additional steps to register the assemblies are automatically placed within the project file. Java - New VisualBean Mode Architecture In prior releases, the ArcGIS Java-COM interop relied upon COM marshalling to synchronize access to ArcObjects hosted in the ArcGIS STA (single thread apartment) thread for Visual Beans applications. At the release of ArcGIS 10, the internal architecture has been revamped to ensure thread affinity and reentrancy requirements of ArcObjects in multi-threaded visual Java applications without relying upon the services of the COM runtime (in particular, COM marshalling). In the new architecture, Java threads do not enter the process wide COM multi threaded apartment (MTA). Instead, ArcObject creation and method invocation is intercepted in the Java tier and performed in a dedicated STA thread created by the Java interop to house ArcObjects. The advantage of this new architecture is vastly improved performance for fine-grained methods calls on ArcObjects, and ability to create and use ArcObjects that did not have marshalling related infrastructure (i.e. proxy-stub DLLs for components that did not rely upon type library marshalling).

Deprecation of Components
ESRI.ArcGIS.Adf Namespace The ESRI.ArcGIS.Adf namespace has been replaced by ESRI.ArcGIS.Adf.Local. This assembly contained various utility type objects for .Net development. This is to take advantage of enhancements in .NET. Most recent ArcGIS Desktop customizations have made use of the original assembly by default so they would need to migrate. VBA After version 10 of ArcGIS VBA will be deprecated. At ArcGIS VBA is not installed by default. The installation can be called from the main dialog shown when inserting the ArcGIS Desktop DVD - "ArcGIS Desktop VBA resources for developers". This installs the VBA resources as well as VBA for ArcGIS Desktop. VBA is now registered and licensed as an Extension. When registering over the internet the user has to select "Other Extensions" as it is not listed by default and enter the name and separate licence number for the extension. VB6 Microsoft support for VB6 was withdrawn in 2008. At ArcGIS 10 VB6 will not be supported and the SDK for VB6 will not be installable. Refer to the Migrating VB6 Desktop Customisations section for further information.

Migrating VBA Customisations


Field Calculator In previous versions of ArcGIS desktop the field calculator could use VBA code to generate the field output. From version 10 the advanced logic can only be written VBScript or Python - not VBA (even if VBA is installed). Label Expressions Label expressions (creating label text for features using code) has only ever been written in VBScript or Jscript (rather than VBA). This is still the case in ArcGIS 10. Network Analyst Evaluators Within the Network Analyst Extension for ArcGIS it is possible to create VBScript based evaluators to calculate attributes. This is still the case in ArcGIS 10, and reduced VBA support does not affect it. VBA Macros and UI Controls If the VBA resources has not been installed there is no ability to view Macros or create UICommands (e.g. UIButton, UITool) although, you can still modify button locations and create new menus etc in the customize dialog (now located in Customize menu>Customize Mode). If you attempt to open an MXD that contains VBA when it is not licensed a message appears to tell you are unable to run it without a VBA licence. Buttons that were created with VBA code will appear but will not work. If VBA is installed and licensed you can no longer specify that UICommand should be created in the Normal.mxt. They can only be created in the current map document. However, Macros can be created in either, although any button linking to a Macro will only be stored in the current MXD. Migration from VBA There are two alternatives to VBA: Python: At ArcGIS 10 a new module has been created that allows map automation. These scripts can be run within the geoprocessing / python environment. However, they are not suited to UI development. Add-Ins: It is now easier to create buttons and tools, however, this needs to be completed within Visual Studio (or equivalent Java IDE) and knowledge of VB.Net or C# or Java is required.

Migrating VB6 Desktop Customisations


As described above Visual Basic 6 is no longer supported within ArcGIS Desktop. The ArcGIS Developer Help has a series of topics describing how VB6 projects should be migrated to VB.NET solutions. In summary, the wizard within Visual Studio 2008 can be used to migrate the VB6 project to VB.NET then the ArcGIS code migrator wizard can be run to convert the solution to version 10 ArcObjects. However, this is not a simple process and requires .NET knowledge to complete.

Migrating .NET Desktop customisations to ArcGIS 10


Prerequisites ArcGIS Desktop .NET customizations are only supported using Microsoft Visual Studio 2008 Sp1 or 2010, using .NET Framework 3.5. Migration Steps Start from the dependant assemblies first. Note: it is possible to target .Net 2.0 assemblies if they are not dependant on ArcObjects. If not already doing so, convert any ArcGIS interfacing components to target .NET Framework 3.5. Use the ArcGIS SDK Visual Studio Add-In wizard to migrate to version 10 ArcObjects. This will replace any deprecated ArcObjects. The Add-In Post build step is to run ESRIRegasm.exe. This is a replacement to using Microsoft's Regasm.exe and registers the assembly as well as creating binary based configuration files that ArcGIS will read to obtain information on commands etc. This step can only be completed by editing the xml of the visual Studio project (there is no way to complete it within the IDE). Note that the COM Interop must still be enabled within the project and category registration must still be specified for all ArcGIS extended objects. Refer to "Migrating ArcGIS 9.3 Desktop and Engine custom components to ArcGIS 10" in developer help for details. Deployment Deployment of ArcGIS .NET customisations are exactly as in previous versions except for the following steps: To check to see whether ArcGIS Desktop has been installed the registry key to search for is HKEY_LOCAL_MACHINE\SOFTWARE\ESRI\Desktop10.0 and the Value is RealVersion="10.0" The ESRI Inc recommended approach to registering the Extended Objects are as follows: - Create a VS class library that contains just an Installer Class (e.g. InvokeESRIRegasm.dll) - Add code to the installer class to run ESRIRegasm.exe (located within Program files\common files on client) - Install the assembly as part of the installation. - Create a custom action that will run the install/uninstall method in the installer class passing in parameters for each assembly that implements Framework ArcObjects. It should no longer be necessary to include installer classes in the custom components that performs the COM registration (or include the raw com or category registrations in the install).

Deployment using WIX The Windows Installer XML (WIX) is a toolset that builds Windows installation packages from XML source code. The toolset supports a command line environment that developers may integrate into their build processes to build MSI and MSM setup packages. Testing has been conducted around deployment of ArcGIS extensions using Windows Installer XML. It is possible to follow the above stated methodology although the installer class can be removed from the process and the ESRIRegAsm. exe can be called directly from the installation wxs file. The steps are as follows: 1. If this is a migration of an old project remove all com and category registration from the wxs scripts. 2. Remove any installer classes unless they are needed for other reasons. 3. Add a reference to WixUtilExtension 4. Add the *.dll and *.tlb as a component to the install. 5. For each com component add the following lines to the Product tag: <CustomAction Id="InvokeESRIRegAsm" Property="InvokeESRIRegAsm" Value="&quot;C:\Program Files\Common Files\ArcGIS\bin\ESRIRegAsm.exe&quot; &quot;[ProgramFilesFolder]<pathtoinstalleddll>&quot; /p Desktop /v 10.0 /s" Execute="immediate" /> <CustomAction Id="InvokeESRIRegAsm" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="check" Impersonate="no" /> <CustomAction Id="InvokeESRIRegAsm_CmdUninstall" Property="InvokeESRIRegAsm_Uninstall" Value="&quot;C:\Program Files\Common Files\ArcGIS\bin\ESRIRegAsm.exe&quot; &quot;[ProgramFilesFolder]<pathtoinstalle ddll>&quot; /p Desktop /v 10.0 /s /u" Execute="immediate" /> <CustomAction Id="InvokeESRIRegAsm_Uninstall" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="check" Impersonate="no" /> 6. For each com component add the following lines to the InstallExecuteSequence: <Custom Action ="InvokeESRIRegAsm_Cmd" After="StartServices">$<component ID>&gt;2</Custom> <Custom Action ="InvokeESRIRegAsm" After="InvokeESRIRegAsm_ CmdCore">$<componentID>&gt;2</Custom> <Custom Action ="InvokeESRIRegAsm_CmdUninstall" After="MsiUnpublishAssemb lies">$<componentID>=2</Custom> <Custom Action ="InvokeESRIRegAsm_Uninstall" After="InvokeESRIRegAsm_ CmdUninstall">$<componentID>=2</Custom>

Migrating COM to Add-Ins


Introduction Add-Ins provide a simpler methodology for developing ArcGIS Desktop applications. See the ArcGIS developer help for a comparison between Add-Ins and traditional COM based approach. At ArcGIS 10 the following types of components can be created as Add-Ins: Commands Tools Menus Multi-items Toolbars (and premier toolbars) Tool Palettes Dockable Windows Extensions Editor Extensions Prerequisites ArcGIS Desktop .NET customizations are only supported using Microsoft Visual Studio 2008 SP1 or 2010, using .Net Framework 3.5. Migration Steps 1. Create a new VS project using the Add-In Template. 2. Create project items for the each Command etc. The items will be entered into the configuration file named Config.esriaddinx and a class will be created for each item. 3. The Config file can be edited to specify names, ids etc. 4. The class for each item will inherit from a class in the namespace ESRI.ArcGIS. Desktop.Addins and you override the implementations for OnClick for example. This class also provides a hook into the ArcGIS application. 5. There is no need to specify the Component registration in the component's class. Deployment Deployment of Add-Ins are similar to .NET / COM components with the following exceptions (note the different registration utility): The ESRI Inc recommended approach to registering the Extended Objects are as follows: - Create a VS class library that contains just an Installer Class (e.g. InvokeESRIRegAddin.dll) - Add code to the installer class to run ESRIRegAddIn.exe (located within Program files\common files on client) - Install the assembly as part of the installation. - Create a custom action that will run the install/uninstall method in the installer class passing in parameters for each assembly that implements Framework ArcObjects.

ArcGIS Engine/Standalone Development


There are no major changes in the development of ArcGIS Engine or Standalone development in version 10. Architecturally, the key difference is that ArcGIS Engine can now be licensed concurrently; however this does not provide any major challenges in development. The only other difference is that ArcGIS Engine must target specific ArcGIS assemblies (there are no policy files). It is not yet known whether services packs will require the deployment to be recompiles. http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/#/what_s_new_ for_developers_at_10_/0001000002zp000000/

ESRI (UK ) Ltd Millennium House 65 Walton Street Aylesbury Buckinghamshire HP21 7QG T 01296 745500 F 01296 745544 E info@esriuk.com www.esriuk.com

2006 2010 ESRI (UK) Ltd and its third party licensors. All rights reserved. The ESRI globe and ESRI products, services and trademarks mentioned are trademarks of Environmental Systems Research Institute, Inc. Other companies and products mentioned herein are the property of their respective trademark owners.

You might also like