Richie 的个人资料The Sandpit - "We hack s...日志列表 工具 帮助
8月1日

How to develop backward compatible ArcGIS application?

This post will describe a technique for developing ArcGIS Desktop (or Engine) customizations that are backwardly compatible.

Let's say you develop a custom toolbar for ArcGIS Desktop on a computer that has ArcGIS Desktop 9.2 sp4 installed.  When that toolbar is deployed to other computers then you may get mixed results.  The toolbar will work on computers with 9.2 sp4, 9.2 sp5, 9.2 sp6 and 9.3 but will barf on computers with 9.0, 9.1, 9.2, 9.2 sp1, 9.2 sp2 and 9.2 sp3.

Notice that by default all customizations are upwardly compatible.  This is because ESRI installs publisher policy files into the GAC so that assembly references are automatically redirected to the current version.

The GAC

But how can you make your toolbar (developed on 9.2 sp4) run on older versions of ArcGIS Desktop?  If you want your toolbar to run on 9.2, 9.2 sp1, 9.2 sp2, 9.2 sp3 then you can:

  1. Compile the toolbar on a computer with 9.2 (no service packs),
  2. Force your project to reference older 9.2 ESRI assemblies.

Obviously the first option requires you to maintain a historic version of ArcGIS Desktop.  This may be inconvenient and possibly not the most efficient use of a computer.  This problem is magnified if you want to deploy a customization that is compatible with older versions like say 9.0 or 9.1.

The second option is the best that I have discovered.  After the initial setup, it only requires minor changes to your .NET projects.  Below I will describe the setup needed to create a customization that supports ArcGIS Desktop 9.2, 9.2 sp1-6 and 9.3.

On any computer:

  1. Install Microsoft .NET 2.0,
  2. Install ArcGIS Desktop 9.2 (do NOT install any service packs),
  3. Copy of the DotNet folder to a location that is accessible to your development computer. Rename the folder to "DotNet92".
    (e.g. copy C:\Program Files\ArcGIS\DotNet to \\ server\files\DotNet92)

On your development computer:

  1. Copy the 9.2 dotnet folder to your development computer
    (e.g. \\ server\files\DotNet92 to C:\Program Files\ArcGIS\DotNet92)

    The ArcGIS Installation Folder

In your Microsoft Visual Studio projects:

  1. Open the project that contains references to the ESRI assemblies.  The path name of the assembly reference should point to the DotNet folder in the ArcGIS Installation folder.

     
  2. In the project properties, click the Reference Paths tab.  Click the ellipse button to navigate to and select the new DotNet92 folder (ie C:\Program Files\ArcGIS\DotNet92).  Click the Add Folder button to add the path name to the list of reference paths.


  3. Save the project.  Restart Microsoft Visual Studio and re-open the project.  If you re-examine the reference paths they should now be directed to the new 9.2 (no sp) assemblies in the DotNet92 folder that you copied from another computer.

The customizations that you developed on this computer are now backwardly compatible to ArcGIS Desktop 9.2 (no sp) and above.  This same technique can be used to create customizations that are backwardly compatible with older versions of ArcGIS Desktop (or Engine) such as 9.0 or 9.1.  Due to assembly changes at 9.0, this technique cannot be used to create customizations that are backwardly computer to pre-9.0 versions like 8.1, 8.2 or 8.3.

One important considering when compiling against an older assembly is that you cannot take advantage of new features.  For example, if you compile a project against 9.1 assemblies then it can be safely run on computers with 9.2 and 9.3 but you will be unable to use new functionality available in those versions.

Technorati Tags: ,,

评论

请稍候...
很抱歉,您输入的评论太长。请缩短您的评论。
您没有输入任何内容,请重试。
很抱歉,我们当前无法添加您的评论。请稍后重试。
若要添加评论,需要您的家长授予您相应权限。请求权限
您的家长禁用了评论功能。
很抱歉,我们当前无法删除您的评论。请稍后重试。
您已超过了一天之内允许提供的评论数上限。请在 24 小时后重试。
因为我们的系统表明您可能在向其他用户提供垃圾评论,您的帐户已禁用了评论功能。如果您认为我们错误地禁用了您的帐户,请联系 Windows Live 支持部门
完成下面的安全检查,您提供评论的过程才能完成。
您在安全检查中键入的字符必须与图片或音频中的字符一致。
Carmichael​Richie 在此页禁用了评论功能。

引用通告

引用此项的网络日志