Defining multiple env for a ArcMap Extension

759
6
Jump to solution
01-29-2013 07:51 AM
Andréde_Mattos_Ferraz
Occasional Contributor
I need define multiple environments for one extension ArcMap, for example: We have a few clients that have 3 environments development, quality and production. On currently scenario we have one DLL registred for the 3  environments and when we make any change on code we just unregister de old DLL and register a newer. Now we want to have 3 DLLs registred (DEV.DLL, QAS.DLL, PRD.DLL).

I tried this, using C# preprocessor directives (I change all buttons and toolbars for something like that):
C# code:
#if (DEV)         [Guid("00000000-47f4-49b9-9724-b9c8038bb4de")]         [ClassInterface(ClassInterfaceType.None)]         [ProgId("GISCAF_PRODUTO.GISCAFExtensionDEV")]     #elif (QAS)         [Guid("11111111-47f4-49b9-9724-b9c8038bb4de")]         [ClassInterface(ClassInterfaceType.None)]         [ProgId("GISCAF_PRODUTO.GISCAFExtensionQAS")]     #elif (PRD)         [Guid("22222222-47f4-49b9-9724-b9c8038bb4de")]         [ClassInterface(ClassInterfaceType.None)]         [ProgId("GISCAF_PRODUTO.GISCAFExtensionPRD")]     #else         [Guid("d3fabbd4-47f4-49b9-9724-b9c8038bb4de")]         [ClassInterface(ClassInterfaceType.None)]         [ProgId("GISCAF_PRODUTO.GISCAFExtension")]     #endif     public class GISCAFExtension : IExtension, IExtensionConfig, IPersistVariant


To deploy I change the build configuration  to generate a correct DLL. But it does  not work, when I try to register the 3 DLLs ALL TOOLBARS and BUTTONS turn into DEV environment. Why? Any suggestion?


Thx in advance,
0 Kudos
1 Solution

Accepted Solutions
RichardWatson
Frequent Contributor
I would create 3 projects but share the key source code.  You can add an existing file to a Visual Studio project as a link.

When you add an existing file, don't click the Add button but rather get the drop down and select Add As Link.  That way you only have 1 set of source code to keep up with.

View solution in original post

0 Kudos
6 Replies
RichardWatson
Frequent Contributor
What version of ArcMap are you using?

If you are using 10.1 then you should be calling ESRIRegAsm and the component category information is in an ecfg (really a zip file) file.  If you using an earlier version then this information is in the registry.

All other COM information is in the registry.  You should be able to look up HKCR\CLSID\YourClassId and see the information related to your class.  Is it correct?

One thing that you might be doing is registering this multiple times, i.e. you might have the the same code registered as DEV, QAS, etc..  Check for this.
0 Kudos
Andréde_Mattos_Ferraz
Occasional Contributor
I'm using arcmap 10

Regedit seems right:
[ATTACH=CONFIG]21200[/ATTACH]

[ATTACH=CONFIG]21201[/ATTACH]

When I do add toolbar on arcmap, all the ToolBars/Commands turn into last environment registred:

[ATTACH=CONFIG]21202[/ATTACH]

[ATTACH=CONFIG]21204[/ATTACH]

Any suggestion?

Thx in advance
0 Kudos
RichardWatson
Frequent Contributor
Perhaps the underlying problem is that you are not changing the GUID for the DLL itself.  It would be cleaner if you had several Visual Studio projects which simply shared code (use linked files) but built independent DLLs.
0 Kudos
Andréde_Mattos_Ferraz
Occasional Contributor
rlwatson, thx for anwser,

Do you know any other approach I can follow?
Three projects is not a good idea because if I make a change on one project, I will need replicate to other projects (it can generate many faults).

What would you do?

Thx in advance
0 Kudos
RichardWatson
Frequent Contributor
I would create 3 projects but share the key source code.  You can add an existing file to a Visual Studio project as a link.

When you add an existing file, don't click the Add button but rather get the drop down and select Add As Link.  That way you only have 1 set of source code to keep up with.
0 Kudos
Andréde_Mattos_Ferraz
Occasional Contributor
rlwatson, very thx

Works Fine!!!

I would create 3 projects but share the key source code.  You can add an existing file to a Visual Studio project as a link.

When you add an existing file, don't click the Add button but rather get the drop down and select Add As Link.  That way you only have 1 set of source code to keep up with.
0 Kudos