WIX and ESRI Component Registration -> ?? BEST PRACTICE ?? <-

6517
9
06-02-2010 03:03 PM
artifact
New Contributor III
We are using Wix to deploy our custom extension and the various .dlls associated with it. I'm a bit curious what ESRI says is the best practice for deploying custom solutions. I have dug through the documentation but there seems to be a lack of information regarding deployment outside of using a Visual Studio setup. Now, because ESRI components no longer make use of the regasm.exe utility, it has now become more difficult for us to register the components using Wix.

Previously we could use heat.exe which would generate a clean fragment for registering assemblies and directly integrate into the installer. This means that the elevated user permissions of the installer itself would deal with the registration. This gave us the ability to perform rollbacks and proper uninstalls. With the new ESRIRegasm.exe This is no longer an option. So what approach should we now be taking?

1. On post-install run a custom action using ESRIRegasm, and thus making harvests of our assemblies more manual oriented and difficult and losing the ability to perform proper rollbacks and uninstalls with out the addition of several more custom actions.

2. Copy the .ecfg file located in: C:\Program Files\Common Files\ArcGIS\Desktop10.0\Configuration\CATID\ and make wix deploy this to the same user directory. This means we have to hard code a path into the installer as well as our build script (YUCK!) Thus we would have to update everything when ESRI decides to change directories for this information.

3. Write our own custom .ecfg creator, This might be an option but I have noticed that the XML format itself has changed slightly over time as ArcGIS has moved from 9.4 b1 to the current 10.0 pre-release.

Some documentation regarding best practices for solution deployment would certainly be nice. How about setting the C:\Program Files\Common Files\ArcGIS\Desktop10.0\Configuration\CATID\ and \bin directories to the path or soem sort of environmental variable. How about some documentation regarding the XML structure of the .ecfg file. Do we run ESRIRegasm on user machines, or are we supposed to deploy the .ecfg directly? I'm open to how you suggest we approach deploying an actual solution in the real world and no x-copy is not a valid solution.
9 Replies
DougBeeman
New Contributor
I can't speak for ESRI, but from what I understand they prefer #1.
I have chosen #2 - distribute the .ecfg files in my Windows Installer to all of the directories that they might be needed in (Desktop, Engine, or Server). It is not quite a hard-coded path because Windows Installer knows how to find the Common Files directory, even if it is somehow a different location than C:\Program Files\Common Files\.
As you mentioned, #1 is a bad idea because it requires two custom actions (reg and unreg) with conditions that will correctly run those actions when necessary (reg on install or upgrade but not uninstall, unreg on uninstall but not upgrade or install). Not to mention the rollback! It is much simpler to let Windows Installer install the .ecfg files. It knows how to handle all those conditions and does rollback correctly, too.
We also did #3 so that we can generate .ecfg files for our VB6 projects, but we still use the .ecfg files in our MSI, not a custom action. I don't see how #3 is any different from #1 if you are planning to run it from a custom action.
0 Kudos
artifact
New Contributor III
Doug,

Thanks for your reply, nice to know that there are others out there that were posed with this issue. I ended up doing option one, and using several custom actions.. Hopefully it wont give us to many problems.

cheers
-j

I can't speak for ESRI, but from what I understand they prefer #1.
I have chosen #2 - distribute the .ecfg files in my Windows Installer to all of the directories that they might be needed in (Desktop, Engine, or Server). It is not quite a hard-coded path because Windows Installer knows how to find the Common Files directory, even if it is somehow a different location than C:\Program Files\Common Files\.
As you mentioned, #1 is a bad idea because it requires two custom actions (reg and unreg) with conditions that will correctly run those actions when necessary (reg on install or upgrade but not uninstall, unreg on uninstall but not upgrade or install). Not to mention the rollback! It is much simpler to let Windows Installer install the .ecfg files. It knows how to handle all those conditions and does rollback correctly, too.
We also did #3 so that we can generate .ecfg files for our VB6 projects, but we still use the .ecfg files in our MSI, not a custom action. I don't see how #3 is any different from #1 if you are planning to run it from a custom action.
0 Kudos
WayneGuidry
New Contributor III
Doug,

Thanks for your reply, nice to know that there are others out there that were posed with this issue. I ended up doing option one, and using several custom actions.. Hopefully it wont give us to many problems.

cheers
-j


I know this is an old thread, but I'm also attempting to use Wix to run esriRegAsm.exe after install and so far am having trouble getting it to run (first time doing custom actions in wix so I'm new to this). I was wondering if you would mind passing on a sample of the scripts you are using for this so I can understand how it is accomplished?

Thanks
Wayne
0 Kudos
KumaravelUmapathy
New Contributor
So did you get the sample code ?
If some one could help me with this that would be great.

How do we install esri custom toolbar and extension using wix. I searched online with no use.

(If you could help me with sample code that would be great.)


Thanks

I know this is an old thread, but I'm also attempting to use Wix to run esriRegAsm.exe after install and so far am having trouble getting it to run (first time doing custom actions in wix so I'm new to this). I was wondering if you would mind passing on a sample of the scripts you are using for this so I can understand how it is accomplished?

Thanks
Wayne
0 Kudos
artifact
New Contributor III
I just saw that this thread became active again. Since there appears be a demand for a sample and ESRI has chosen to remain silent, here is a sample wix script with the register and unregister custom actions. I'll leave it to you to determine the best way to handle your conditions. I handle it by running paraffin on the binaries for installation. This generates an xml fragment that I can use to determine if the assembly needs to be registered or unregistered based on guid value. Also, this script is a generic product fragment, it uses additional wix include files that are pulled from product specific directories to fill the variables. Anyway, hope this helps anyone struggling to use wix with esriregasm.exe

<?xml version="1.0" encoding="UTF-8"?>
  <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

    <!-- include file that defines the product specific ID, UPGRADECODE and CODEPAGE values-->
    <?include $(sys.CURRENTDIR)\ProductDefinitionInclude.wxi ?>

    <Product Id ='$(var.ProductId)'
             UpgradeCode='$(var.ProductUpgradeCode)'
             Codepage='$(var.ProductCodepage)'
             Name='!(loc.ProductName)'
             Language='!(loc.LANGUAGE)'
             Version='$(env.VERSION).$(env.BUILD_INFO)'
             Manufacturer='!(loc.Manufacturer)' >

    <Package InstallerVersion='200'
               Compressed='yes'
               Keywords='!(loc.PackageKeywords)'
               Description='!(loc.PackageDescription)'
               Comments='!(loc.PackageComments)'
               Manufacturer='!(loc.Manufacturer)'
               Languages='!(loc.LANGUAGE)'
               SummaryCodepage='$(var.ProductCodepage)'
               InstallPrivileges='elevated' />

    <Media Id="1"
             Cabinet="$(env.PRODUCT).cab"
             EmbedCab="yes"
             DiskPrompt="CD-ROM #1" />

    <Property Id='DiskPrompt'
            Value="!(loc.DiskPrompt)" />

      <InstallExecuteSequence>
        <Custom Action='ExecEsriRegister' After='InstallFinalize'>NOT_REMOVE</Custom>
        <Custom Action='ExecEsriUnregister' Before='RemoveFiles'>REMOVE</Custom>
      </InstallExecuteSequence>

    <CustomAction Id='ExecEsriRegister'
                  Directory='PRODUCT_DIR'
                  Execute='immediate'
                  ExeCommand='[CommonFilesFolder]\ArcGIS\bin\ESRIRegasm.exe /p:Desktop /s &quot;[PRODUCT_DIR]$(var.ProductInstalledDir).dll&quot;'
                  Return='check'/>

    <CustomAction Id='ExecEsriUnregister'
              Directory='PRODUCT_DIR'
              Execute='immediate'
              ExeCommand='[CommonFilesFolder]\ArcGIS\bin\ESRIRegasm.exe /p:Desktop /s /u &quot;[PRODUCT_DIR]$(var.ProductInstalledDir).dll&quot;'
              Return='check'/>

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALL_DIRECTORY" Name='COMPANY_NAME'>
          <Directory Id="PRODUCT_DIR" Name='$(var.ProductInstalledDir)' />
        </Directory>
      </Directory>
    </Directory>

    <Feature Id="Complete" Level="1">
      <ComponentGroupRef Id='PRODUCT_BINARIES'/>
    </Feature>

    <!-- user interface stuff here -->
    <Property Id="WIXUI_INSTALLDIR" Value="PRODUCT_DIR" />
    <UIRef Id="WixUI_InstallDir" />
    <UIRef Id="WixUI_ErrorProgressText" />

    <Icon Id="ARPIcon.ico" SourceFile="$(sys.CURRENTDIR)\bitmaps\ARPIcon.ico" />
    <Property Id="ARPPRODUCTICON" Value="ARPIcon.ico" />
    <Property Id="ARPCOMMENTS" Value='!(loc.PackageComments)' />
    <Property Id="ARPCONTACT" Value='!(loc.Manufacturer)' />

    <!-- <Property Id="ARPHELPLINK" Value="Your help link" />
    <Property Id="ARPREADME" Value="Your README link" /> -->
    <Property Id="ARPURLINFOABOUT" Value='!(loc.Website)' />
    <Property Id="ARPURLUPDATEINFO" Value='!(loc.Website)' />
    <Property Id="ARPHELPTELEPHONE" Value='!(loc.PhoneNumber)' />
    <!-- <Property Id="ARPAUTHORIZEDCDFPREFIX" Value="URL of the update channel for the application" /> -->
    <Property Id="ARPSIZE" Value="44" />

    <!-- <Property Id="ARPNOMODIFY" Value="1" /> modify the program button has been disabled
    <Property Id="ARPNOREPAIR" Value="0" /> repair program button is enabled
    <Property Id="ARPNOREMOVE" Value="0" />  remove program button is enabled
    <Property Id="ARPSYSTEMCOMPONENT" Value="0" /> set to 1 = using the command line or a transform prevents the application from being displayed in the Add or Remove Programs list of Control Panel -->

    <!-- other installer imagery/license -->
    <WixVariable Id="WixUIDialogBmp" Value="$(sys.CURRENTDIR)\bitmaps\WixUIDialogBmp.bmp" />
    <WixVariable Id="WixUIBannerBmp" Value="$(sys.CURRENTDIR)\bitmaps\WixUIBannerBmp.bmp" />
    <WixVariable Id="WixUILicenseRtf" Value="$(sys.CURRENTDIR)\License.rtf" />

    </Product>

  </Wix>
0 Kudos
by Anonymous User
Not applicable
The example was a good starting point but did'nt work for me under windows 8 (Visual Studio 2012, WiX Toolset v3.7) . I had problems with privileges for running ERSRIRegAsm.exe ("ESRIRegAsm is evil"). The solution was to change "Execute='immediate'" to "Execute='deferred'. It seems that only deferred custom actions can run elevated using the system context.

My Code:

...
<CustomAction Id='ExecEsriRegister'
                  Directory='INSTALLLOCATION'
                  Execute='deferred'
                  Impersonate='no'
                  ExeCommand='"[CommonFilesFolder]ArcGIS\bin\ESRIRegAsm.exe" /p:Desktop /s &quot;[INSTALLLOCATION]Test.dll&quot;'
                  Return='ignore'/>

    <CustomAction Id='ExecEsriUnregister'
                  Directory='INSTALLLOCATION'
                  Execute='deferred'
                  Impersonate='no'
                  ExeCommand='"[CommonFilesFolder]ArcGIS\bin\ESRIRegAsm.exe" /p:Desktop /s /u &quot;[INSTALLLOCATION]Test.dll&quot;'
                  Return='ignore' />

    <InstallExecuteSequence>
      <Custom Action='ExecEsriRegister' After='InstallFiles'>NOT Installed</Custom>
      <Custom Action='ExecEsriUnregister' Before='RemoveFiles'>Installed AND (REMOVE = "ALL")</Custom>
    </InstallExecuteSequence>
...


I am still waiting for ESRI to provide us with some useful example code.
0 Kudos
artifact
New Contributor III
Haefele,

Glad to hear the sample gave you a good starting point. I also ran into the issue on windows 8, thanks for the update.. At this point i've given up on ESRI. I mean, I posted the original thread in 2010. On top of that they seem to change the dev forums every damn release now. It's starting to feel like the "old" esri forum days, where it was all reverse engineering...... neil comeback and save us all 🙂 lol


The example was a good starting point but did'nt work for me under windows 8 (Visual Studio 2012, WiX Toolset v3.7) . I had problems with privileges for running ERSRIRegAsm.exe ("ESRIRegAsm is evil"). The solution was to change "Execute='immediate'" to "Execute='deferred'. It seems that only deferred custom actions can run elevated using the system context.

My Code:

...
<CustomAction Id='ExecEsriRegister'
                  Directory='INSTALLLOCATION'
                  Execute='deferred'
                  Impersonate='no'
                  ExeCommand='"[CommonFilesFolder]ArcGIS\bin\ESRIRegAsm.exe" /p:Desktop /s &quot;[INSTALLLOCATION]Test.dll&quot;'
                  Return='ignore'/>

    <CustomAction Id='ExecEsriUnregister'
                  Directory='INSTALLLOCATION'
                  Execute='deferred'
                  Impersonate='no'
                  ExeCommand='"[CommonFilesFolder]ArcGIS\bin\ESRIRegAsm.exe" /p:Desktop /s /u &quot;[INSTALLLOCATION]Test.dll&quot;'
                  Return='ignore' />

    <InstallExecuteSequence>
      <Custom Action='ExecEsriRegister' After='InstallFiles'>NOT Installed</Custom>
      <Custom Action='ExecEsriUnregister' Before='RemoveFiles'>Installed AND (REMOVE = "ALL")</Custom>
    </InstallExecuteSequence>
...


I am still waiting for ESRI to provide us with some useful example code.
0 Kudos
sameerpuppal
Occasional Contributor
Hi All,

Even i am struggling with similar thing. I am not able to register using wix. can you share your wix files for reference? did it run on windows 7?

regards,
sameer
0 Kudos
DougBeeman
New Contributor

Don't forget that your custom actions should handle rollback. I'm not sure, but I think it would be something like this:

...
    <CustomAction Id='ExecEsriRegisterRollback'
                  Directory='INSTALLLOCATION'
                  Execute='rollback'
                  Impersonate='no'
                  ExeCommand='"[CommonFilesFolder]ArcGIS\bin\ESRIRegAsm.exe" /p:Desktop /s /u "[INSTALLLOCATION]Test.dll"'
                  Return='check' />

    <CustomAction Id='ExecEsriRegister'
                  Directory='INSTALLLOCATION'
                  Execute='deferred'
                  Impersonate='no'
                  ExeCommand='"[CommonFilesFolder]ArcGIS\bin\ESRIRegAsm.exe" /p:Desktop /s "[INSTALLLOCATION]Test.dll"'
                  Return='check'/>

    <CustomAction Id='ExecEsriUnregisterRollback'
                  Directory='INSTALLLOCATION'
                  Execute='rollback'
                  Impersonate='no'
                  ExeCommand='"[CommonFilesFolder]ArcGIS\bin\ESRIRegAsm.exe" /p:Desktop /s "[INSTALLLOCATION]Test.dll"'
                  Return='check'/>

    <CustomAction Id='ExecEsriUnregister'
                  Directory='INSTALLLOCATION'
                  Execute='deferred'
                  Impersonate='no'
                  ExeCommand='"[CommonFilesFolder]ArcGIS\bin\ESRIRegAsm.exe" /p:Desktop /s /u "[INSTALLLOCATION]Test.dll"'
                  Return='check' />

    <InstallExecuteSequence>
      <Custom Action='ExecEsriRegisterRollback' After='InstallFiles'>NOT Installed</Custom>
      <Custom Action='ExecEsriRegister' After='ExecEsriRegisterRollback'>NOT Installed</Custom>
      <Custom Action='ExecEsriUnregisterRollback' Before='RemoveFiles'>Installed AND (REMOVE ~= "ALL")</Custom>
      <Custom Action='ExecEsriUnregister' After='ExecEsriUnregisterRollback'>Installed AND (REMOVE ~= "ALL")</Custom>
    </InstallExecuteSequence>
...‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍


Because these custom actions are complicated to set up correctly, I have decided to do the following instead:

  1. Run ESRIRegAsm.exe with the /regfile option
  2. Run Heat on that .reg file
  3. Include the generated heat fragment and the .ecfg file in my installer
0 Kudos