Since there can be a wide variance as to what .net runtime components an end user has installed on their PC it was therefore a requirement to perform some up front checks as a prerequisite to an install on a given target PC.
The application has three required components that must be deployed to a candidate client PC, these are as follows:
- .Net Framework 4.0
- Multi-Targeting Pack for Microsoft .NET Framework 4.0.1 (KB2495638)
- WCF Data Services 5.0 for OData V3
A WIX installer was created, the Conditions.wxi contains obviously enough the prerequisite conditions for the deployment. The Product.wxs contains all of the assembly references for the application files. The Strings_en-us.wxl obviously contains localised strings for the installer messages etc..
So the conditions where defined as shown in the following snippet:
<Property Id="UPDATE401"> <RegistrySearch Id="Update401x32" Type="raw" Root="HKLM" Key="SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0.1" Win64="no" /> </Property>
<Property Id="UPDATE401X64"> <RegistrySearch Id="Update401x64" Type="raw" Root="HKLM" Key="SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0.1" Win64="yes" /> </Property>
<Property Id="ODATA"> <RegistrySearch Id="ODataRegistry32" Type="raw" Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft WCF Data Services\5.0" Name="Version" Win64="no" /> </Property>
<Property Id="ODATAX64"> <RegistrySearch Id="ODataRegistry64" Type="raw" Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft WCF Data Services\5.0" Name="Version" Win64="yes" /> </Property>
<Condition Message='!(loc.Update401Missing)'><![CDATA[(UPDATE401 <> "" OR UPDATE401X64 <> "") OR Installed]]></Condition>
<Condition Message='!(loc.ODataMissing)'><![CDATA[(ODATA <> "" OR ODATAX64 <> "") OR Installed]]></Condition>
The corresponding message strings are shown in the following snippet:
<String Id="ODataMissing" Overridable="yes">WCF Data Services 5.0 for OData V3 missing [http://www.microsoft.com/en-ie/download/details.aspx?id=29306] </String> <String Id="Update401Missing" Overridable="yes">Multi-Targeting Pack for Microsoft .NET Framework 4.0.1 (KB2495638) [http://www.microsoft.com/en-ie/download/details.aspx?id=27757]</String>
In some deployments the end user will install the application I decided to add references to the download pages for the .Net framework components that this application requires to be deployed to the PC before the application will execute on the PC. In larger client environments the application and the dependant components will be deployed using automated deployment systems.
On compiling the WIX application the following errors where reported.
Emex.Workflow.Designer.Installer\Conditions.wxi(20,0): error LGHT0204: ICE03: Invalid format string; Table: LaunchCondition, Column: Description, Key(s): (UPDATE401 <> "" OR UPDATE401X64 <> "") OR Installed
Emex.Workflow.Designer.Installer\Conditions.wxi(22,0): error LGHT0204: ICE03: Invalid format string; Table: LaunchCondition, Column: Description, Key(s): (ODATA <> "" OR ODATAX64 <> "") OR Installed
At first this looks like the error is due to the condition expression being incorrect. But this is not the case. The problem is actually the message strings, the [ ] delimiters that I had used around the links, for no obvious reason, where the cause of the problem. To resolve the errors it was simply a case of escaping the delimiters as per the rules here.
<String Id="ODataMissing" Overridable="yes">WCF Data Services 5.0 for OData V3 missing [\[]http://www.microsoft.com/en-ie/download/details.aspx?id=29306]</String>
No comments:
Post a Comment