Wouldn’t it be cool to create a setup for your own Data Standard customizations? Yes, a setup with a version, secure to install and easy to deploy, and simple to upgrade? It’s easier than you think. For this purpose, we use the open source WIX toolset. We need a batch-file like this
"c:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe" dir ..\VDS -cg VDSGroup -out VDSGroup.wxs -gg -srd -dr DataStandardFolder "c:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe" VDSGroup.wxs "c:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe" Customer1.wxs -dPVersion=1.0.1 "c:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe" Customer1.wixobj VDSGroup.wixobj -out Customer1.msi -b ..\VDS del VDSGroup.wxs del *.wix* pause
and a master XML instruction file like this:
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'> <?define UpgradeCode="041e09fb-6cde-431f-8955-d9a019cb8a35"?> <?define ComponentGUID="041e09fb-6cde-431f-8955-d9a019cb8a35"?> <Product Name='Customer1 VDS Setup' Manufacturer='coolOrange' Id='*' UpgradeCode='$(var.UpgradeCode)' Version='$(var.PVersion)' Language='1033' Codepage='1252'> <Package Id='*' Description="Customer1 VDS Installer" Manufacturer='coolOrange' Keywords='Installer' InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252'/> <Upgrade Id='$(var.UpgradeCode)'> <UpgradeVersion OnlyDetect='no' Property='PREVIOUSFOUND' Minimum='1.0.0' IncludeMinimum='yes' Maximum='$(var.PVersion)' IncludeMaximum='no'/> </Upgrade> <Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt='CD-ROM #1'/> <Property Id='DiskPrompt' Value="Customer VDS Installation "/> <Directory Id='TARGETDIR' Name='SourceDir'> <Directory Id='CommonAppDataFolder' Name='ProgramData'> <Directory Id='AutodeskFolder' Name='Autodesk'> <Directory Id='VaultFolder' Name='Vault 2017'> <Directory Id='ExtensionFolder' Name='Extensions'> <Directory Id='DataStandardFolder' Name='DataStandard'> <Component Id='DataStandardFolderComponent' Guid='$(var.ComponentGUID)'> <CreateFolder/> </Component> </Directory> </Directory> </Directory> </Directory> </Directory> </Directory> <Feature Id='Complete' Level='1'> <ComponentGroupRef Id='VDSGroup'/> <ComponentRef Id='DataStandardFolderComponent'/> </Feature> <InstallExecuteSequence> <RemoveExistingProducts Before="InstallInitialize"/> </InstallExecuteSequence> </Product> </Wix>
Ok. Let’s make a step back. You diligently store your Data Standard customizations into a dedicated folder, right? That folder has the same structure as the Data Standard folder structure, something like this
Therefore, you could just take what you have in your clean customization folder, and compile it into a simple setup. For this purpose, we use 3 tools from the WIX toolset: heat.exe for gathering the folders/files information, candle.exe for compiling the information into an object (binary) file, and light.exe for linking the object files and the real files into a msi setup.
In my example, I have under Customer1, a Setup and the VDS folder. The VDS folder contains the sub-folders with the according VDS files. The setup folder, contains the setup files.
As you can see, we have the make.bat (see the first code block above) and the Customer1.wxs (see xml code above). Now, if you install the WIX toolset and create the same structure as in this example, you can run the make.bat, and you will get a customer1.msi that you can install.
OK, let’s add some more info here. Let’s start with the batch-file that we call make.bat. As you can see in the code, the batch file first collects all the folders and files within the VDS folder via the tool heat.exe
heat.exe" dir ..\VDS -cg VDSGroup -out VDSGroup.wxs -gg -srd -dr DataStandardFolder
The first argument dir should be clear. It’s where the heat.exe should start collecting information. In our case, it’s one folder up (..\) and then in the VDS folder. The second argument will give a kind of title to the collected information. We will call it VDSGroup. The result of the gathering shall be saved into the file VDSGroup.wxs. The last argument is a placeholder we will use later.
The next line is
which compiles the information generated by the heat.exe in the line before. The next one is again a candle.exe, but with our master file, which we will talk about in a minute.
candle.exe" Customer1.wxs -dPVersion=1.0.1
What you see here, is that we pass the version for our setup as an argument. So, just increase the version, and you can update your previous setup. The pervious version will be removed and replaced with the new one.
Finally, we have
light.exe" Customer1.wixobj VDSGroup.wixobj -out Customer1.msi -b ..\VDS
which takes the compiled Customer1.wixobj and VDSGroup.wixobj files and link them together into a msi setup. The light.exe also takes the original files into the setup, therefore, we need to tell him where the files are (-b ..\VDS), like we did for the heat.exe in the first step.
Let’s now have a look to the Customer1.wxs, you have the XML code above. In this file, we have information about the setup name and the author, so, just go ahead and change the Customer1 with your customer or project name, and replace coolOrange with your company name. In the very first two lines, you’ll see
<?define UpgradeCode="041e09fb-6cde-431f-8955-d9a019cb8a35"?> <?define ComponentGUID="041e09fb-6cde-431f-8955-d9a019cb8a35"?>
The sequence of number here is called GUID and identifies uniquely this setup for future updates. You need your own GUID, so please go to http://www.guidgenerator.com and generate a new GUID for your setup. DO NOT USE THESE GUIDs!!!!!!!! Have you seen all the exclamation marks?? DON’T USE THESE GUIDs! MAKE YOUR OWN, and replace the one in the file with yours. Get a new GUID for each new project-setup you will make.
I’m skipping most of the elements, as they are good this way, so let’s jump to the Directory elements.
<Directory Id='TARGETDIR' Name='SourceDir'> <Directory Id='CommonAppDataFolder' Name='ProgramData'> <Directory Id='AutodeskFolder' Name='Autodesk'> <Directory Id='VaultFolder' Name='Vault 2017'> <Directory Id='ExtensionFolder' Name='Extensions'> <Directory Id='DataStandardFolder' Name='DataStandard'> ......
This section will define the folder structure where the setup will install the files. Each Directory entry must have his unique ID. The second Directory element points to the ProgramData folder, and all the following Directory entries will be the physical sub-folders. Note the almost last Directory entry? It’s called DataStandardFolder. If you remember, in the batch-file, the last argument of the heat.exe is also DataStandardFolder. This way, the data collected by heat, will be added to our folder structure at this point. So, the sub-folder collected by heat.exe will become the sub-folders of our folder structure in the Customer1.wxs.
So, this Customer1.wxs is already quite good for covering the needs in order to create a VDS setup. Just check that your folder structure points to the appropriate Vault version (2016, 2017, 2018, etc.), set your GUIDs, change the description and you are good to go!
Every time you like to create a new version of the setup, just increase the version in the batch-file, and run the make.bat. You will have a new setup, with according version number. Make some tries. You will see how by installing a new version of the setup, old files will be removed and new files installed.
WIX is highly capable, so if you like to create more fancy setups, you can walk though the tutorial posted here. This blog post here covers just the basic, but you can go further. For example, we create client side setups that contains VDS files, powerEvents files, and other client side stuff. And we also create setups for the powerJobs, just applying the same logic. In the case where you have different sources that you like to combine into one setup, then you can have the heat.exe executed several times, compile the wxs files via candle, and then combine them all into the light.exe, by passing all the object files and adding all the source folders via the –b switch (-b source1 –b source2 –b source3). Good luck!