Wix Port for 5.3 Release
Contents
- 1 Tool Installation
- 2 5.2 Project and Solution Configurations and Platforms
- 3 5.3 Cleaned Up Configurations and Platforms
- 4 Modified Obfuscation Project
- 5 Problem With Wix 3.8
- 6 Modified WiX Projects
- 7 Appendix A: Examination of the WiX Output Log to Understand How WiX Works
- 8 Appendix B: Defined Parms Passed in to Candle
Tool Installation
First I purchased and installed VDProj to WiX Converter
[[image:]]
Then I uninstalled and reinstalled WiX Toolset. The actions on WiX Toolset were necessary in order to get it to register itself properly with Visual Studio 2013.
Then, I used VDProj to WiX Converter to automatically convert the setup/deployment projects in the 5.2 OPP solution to Wix projects:
[[image:]]
5.2 Project and Solution Configurations and Platforms
Configuration/Platform |
32-bit OPP |
64-bit OPP |
Solution |
Obf_x86/Any CPU |
Obf_x64/Any CPU |
Generic Projects |
ObfuscatedRelease/x86 |
ObfuscatedRelease/Any CPU |
COMShim Project |
ObfuscatedRelease/Win32 |
ObfuscatedRelease/x64 |
Setup Projects |
ObfuscatedRelease/[blank] |
ObfuscatedRelease/[blank] |
Obfuscation Project |
Release/x86 |
Release/Any CPU |
MSICustomAction Project |
ObfuscatedRelease/Any CPU |
ObfuscatedRelease/Any CPU |
MSI Fix Project |
ObfuscatedRelease/Any CPU |
ObfuscatedRelease/Any CPU |
Project Config/Platform |
Used For |
Target CPU |
Output Path |
ObfuscatedRelease/x86 |
Generic Projects 32-bit |
x86 |
/bin/Release |
ObfuscatedRelease/Any CPU |
Generic Projects 64-bit |
Any CPU |
/bin/Release |
ObfuscatedRelease/Win32 |
COM Shim 32-bit |
win32 |
Release\ |
ObfuscatedRelease/x64 |
COM Shim 64-bit |
x64 |
Release\ |
Release/x86 |
Obfuscation 32-bit |
N/A |
N/A |
Release/Any CPU |
Obfuscation 64-bit |
N/A |
N/A |
5.3 Cleaned Up Configurations and Platforms
One goal of 5.3 is to simplify and rationalize these configurations so that someone other than I can understand and maintain them. Here is the proposal:
Configuration/Platform |
32-bit OPP |
64-bit OPP |
Solution |
ObfuscatedRelease/x86 |
ObfuscatedRelease/x64 |
Generic Projects |
Release/Any CPU |
Release/Any CPU |
COMShim Project |
Release/Win32 |
Release/x64 |
Setup Projects |
Release/Any CPU |
Release/Any CPU |
Obfuscation Project |
Release/Any CPU |
Release/Any CPU |
Project Config/Platform |
Used For |
Target CPU |
Output Path |
Release/Any CPU |
All except COM Shim Projects |
Any CPU |
/bin/Release |
Release/Win32 |
COM Shim 32-bit |
win32 |
Release\ |
Release/x64 |
COM Shim 64-bit |
x64 |
Release\ |
Modified Obfuscation Project
I made a few long-needed improvements to the the obfuscation project:
- Since WiX allows me to specify the paths from which it grabs the binaries, I removed “CopyFileBack” from Obfusc.bat and just had it copy everything back from MSP_Addin\bin\ObfuscatedRelease to the MSP_Addin\bin\Release directory, where the new WiX deployment projects will grab them for the msi files. This is now just a simple cal to xcopy.
- I cleaned up the Dotfuscator config files:
- I gave them more meaningful names Obfusc_OPP and Obfusc_OPX
- I edited these Dotfuscator config files to use relative path names so that they can be moved easily from one machine to another!
- I turned off the annoying “Smart Obfuscation” verbose logs
- I removed all code in Obfusc.bat that formerly supported obfuscating Debug configurations
Problem With Wix 3.8
After generating the WiX projects for the release builds of OPP, I started getting a fatal error in running heat.exe on the COM Shim:
[[image:|624x67px]]
I discovered that this is a known bug in WiX 3.8, so I downloaded WiX 3.9 R2, and that fixed it!
Modified WiX Projects
I made a few changes to the WiX projects that were automatically generated by VDProj to WiX Converter.
- I made some changes to the XML file Product.wxs:
- Changed /bin/ObfuscatedRelease to /bin/Release/ for CA_CustomAction
Appendix A: Examination of the WiX Output Log to Understand How WiX Works
Here I examine each step in the execution of the WiX project as captured in the log for the OPP Debug solution. The obfuscated release solution will be more complex, but this gives a good idea of the basic information flow. The goal is to understand and modify the wix project to make things robust and fully customizable by me.
Step 1: Heat.exe extracts COM registration information from CG_MSP_Addin.dll. Note that the specific version of CG_MSP_Addin.dll (e.g. 5.3.5614.27217) is recorded in the CLSID registry key, so this information MUST BE extracted on every build. Thus this step needs to be retained in the Visual Studio project.
“WIXBIN\heat.exe" file "BINOUT\CG_MSP_Addin.dll"
-sw
-gg
-sfrag
-nologo
-srd
-out "obj\\Debug\Harvested XML\_CG_MSP_Addin.com.xml"
[_CG_MSP_Addin.com.xml is here:]
[[image:|624x186px]]
Step 2: Heat.exe extracts information about CG_MSP_Addin.dll from CG_MSP_Addin.vbproj in order to add CG_MSP_Addin.dll as a component to DirectoryRef to the Component group and to source it from ..\..\ OPP\CG_MSP_Addin\bin\Release\CG_MSP_Addin.dll.
"WIXBIN\heat.exe" project "PROJDIR\CG_MSP_Addin.vbproj"
-projectname "CG_MSP_Addin"
-pog Binaries
-gg
-sfrag
-nologo
-out "obj\\Debug\Harvested XML\_CG_MSP_Addin.xml" (shown below)[[image:|518x134px]]
Step 3: Candle.exe compiles Product.wxs into Product.wixobj for x86 architecture. The ‘-d’ items are defined properties and the ‘sw’ items tell candle to ignore warnings/errors.
WIXBIN\candle.exe
-sw1076
-sw1072
-dSolutionDir=PROJROOT\
...
-dCG_MSP_Addin.TargetPath=BINOUT\CG_MSP_Addin.dll
-out obj\\Debug\
-arch x86
Product.wxs
Step 4: Candle.exe pre-compiles the two xml files extracted by heat.exe into _CG_MSP_Addin.wsx and then into _CG_MSP_Addin.wxs and then compiles that wxs file into a wixobj file:
WIXBIN\candle.exe
-sw1076
-sw1072
-dSolutionDir=PROJROOT\
-dSolutionExt=.sln
...
-dCG_MSP_Addin.TargetName=CG_MSP_Addin
–dCG_MSP_Addin.TargetPath=BINOUT\CG_MSP_Addin.dll
-out obj\\Debug\pthCCA824CBBF896676CC2DFDDF8243132D\
-arch x86
"obj\\Debug\Harvested Output\_CG_MSP_Addin.wxs"
Here is the wsx file generated from the two XML files from heat.exe
[[image:|624x194px]]
and here is the wxs file that is generated from the two XML files from heat.exe
[[image:|624x209px]]
Step 5: Light.exe finally generates the msi file by linking together the outputs of Step 3 (Product.wixobj) and Step 4 (_CG_MSP_Addin.wixobj)
WIXBIN\Light.exe
-out PROJROOT\OPP\CG_MSP_AddinSetupForDebug_wix\bin\Debug\OnePagerPro_5_2_0.msi
-sw1076
-sw1072
-cultures:null
-sice:ICE57
-contentsfile obj\\Debug\CG_MSP_AddinSetupForDebug_wix.wixproj.BindContentsFileListnull.txt
-outputsfile obj\\Debug\CG_MSP_AddinSetupForDebug_wix.wixproj.BindOutputsFileListnull.txt
-builtoutputsfile obj\\Debug\CG_MSP_AddinSetupForDebug_wix.wixproj.BindBuiltOutputsFileListnull.txt
-wixprojectfile PROJROOT\OPP\CG_MSP_AddinSetupForDebug_wix\CG_MSP_AddinSetupForDebug_wix.wixproj
obj\\Debug\Product.wixobj
obj\\Debug\pthCCA824CBBF896676CC2DFDDF8243132D\_CG_MSP_Addin.wixobj
Appendix B: Defined Parms Passed in to Candle
Note that I used the abbreviation %baseDir% = C:\Users\Owner\Documents\_CG_Dev\Projects\
Defined Parm |
What It Translates Into |
SolutionDir |
%baseDir% |
SolutionExt |
.sln |
SolutionFileName |
MSP_Addin_Debug.sln |
SolutionName |
MSP_Addin_Debug |
SolutionPath |
%baseDir%MSP_Addin_Debug.sln |
Configuration |
Debug |
OutDir |
bin\Debug\ |
Platform |
x86 |
ProjectDir |
%baseDir%OPP\CG_MSP_AddinSetupForDebug_wix\ |
ProjectExt |
.wixproj |
ProjectFileName |
CG_MSP_AddinSetupForDebug_wix.wixproj |
ProjectName |
CG_MSP_AddinSetupForDebug_wix |
ProjectPath |
%baseDir%OPP\CG_MSP_AddinSetupForDebug_wix\CG_MSP_AddinSetupForDebug_wix.wixproj |
TargetDir |
%baseDir%OPP\CG_MSP_AddinSetupForDebug_wix\bin\Debug\ |
TargetExt |
.msi |
TargetFileName |
OnePagerPro_5_2_0.msi |
TargetName |
OnePagerPro_5_2_0 |
TargetPath |
%baseDir%OPP\CG_MSP_AddinSetupForDebug_wix\bin\Debug\OnePagerPro_5_2_0.msi |
CG_MSP_Addin.Configuration |
Debug |
CG_MSP_Addin.Platform |
AnyCPU |
CG_MSP_Addin.ProjectDir |
%baseDir%OPP\CG_MSP_Addin\ |
CG_MSP_Addin.ProjectExt |
.vbproj |
CG_MSP_Addin.ProjectFileName |
CG_MSP_Addin.vbproj |
CG_MSP_Addin.ProjectName |
CG_MSP_Addin |
CG_MSP_Addin.ProjectPath |
%baseDir%OPP\CG_MSP_Addin\CG_MSP_Addin.vbproj |
CG_MSP_Addin.TargetDir |
%baseDir%OPP\CG_MSP_Addin\bin\Debug\ |
CG_MSP_Addin.TargetExt |
.dll |
CG_MSP_Addin.TargetFileName |
CG_MSP_Addin.dll |
CG_MSP_Addin.TargetName |
CG_MSP_Addin |
CG_MSP_Addin.TargetPath |
%baseDir%OPP\CG_MSP_Addin\bin\Debug\CG_MSP_Addin.dll |