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.
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
<?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 "[PRODUCT_DIR]$(var.ProductInstalledDir).dll"' Return='check'/> <CustomAction Id='ExecEsriUnregister' Directory='PRODUCT_DIR' Execute='immediate' ExeCommand='[CommonFilesFolder]\ArcGIS\bin\ESRIRegasm.exe /p:Desktop /s /u "[PRODUCT_DIR]$(var.ProductInstalledDir).dll"' 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>
... <CustomAction Id='ExecEsriRegister' Directory='INSTALLLOCATION' Execute='deferred' Impersonate='no' ExeCommand='"[CommonFilesFolder]ArcGIS\bin\ESRIRegAsm.exe" /p:Desktop /s "[INSTALLLOCATION]Test.dll"' Return='ignore'/> <CustomAction Id='ExecEsriUnregister' Directory='INSTALLLOCATION' Execute='deferred' Impersonate='no' ExeCommand='"[CommonFilesFolder]ArcGIS\bin\ESRIRegAsm.exe" /p:Desktop /s /u "[INSTALLLOCATION]Test.dll"' Return='ignore' /> <InstallExecuteSequence> <Custom Action='ExecEsriRegister' After='InstallFiles'>NOT Installed</Custom> <Custom Action='ExecEsriUnregister' Before='RemoveFiles'>Installed AND (REMOVE = "ALL")</Custom> </InstallExecuteSequence> ...
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 "[INSTALLLOCATION]Test.dll"' Return='ignore'/> <CustomAction Id='ExecEsriUnregister' Directory='INSTALLLOCATION' Execute='deferred' Impersonate='no' ExeCommand='"[CommonFilesFolder]ArcGIS\bin\ESRIRegAsm.exe" /p:Desktop /s /u "[INSTALLLOCATION]Test.dll"' 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.
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: