[Reference] Windows Installer XML (WiX) 3.0 Snippets
2008-02-07 13:49
537 查看
http://blog.wharton.com.au/2007/06/windows-installer-xml-wix-30-snippets.html
Windows Installer XML (WiX) 3.0 Snippets
One of my tasks at DITR is the creation and refining of WiX packages.We are currently using Beta 3.0 which has proven to be quite a challenge as there are not many examples available to assist the novice WiX deployer (which I am). There are however heaps of v2.0 examples available that only need some minor modifications to make them work correctly under 3.0.
As I’ve spent a great deal of time researching and trialing different techniques, I thought I’d post some snippets to assist those looking for similar functionality. These snippets may not be 100% perfect, but they work and will give you a head start on using this great toolset.
To use these examples you must include the following namespace declarations in your WiX project:
<?xmlversion="1.0"encoding="UTF-8"?>>
<!—
Add the xmlns:iis attribute to allow access to WIX IIS functions (Requires WixIIsExtension reference)
Add the xmlns:util attribute to allow access to WIX util functions (Requires WixUtilExtension reference)
-->>
<Wixxmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
</Wix> >
There is also a bug in the IDE version of the WiX which does not persist the “Cultures” property (found on the Linker Tab of the Project Properties dialog) in the “.wixproj” file meaning that you will get an error when trying to use these namespaces. You need to open the “.wixproj” file for your project in notepad and set the “Cultures” attribute to “en-US” (or whatever culture you are using for your project) in both the ‘Debug’ and ‘Release’ nodes:
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<Cultures>en-US</Cultures>
</PropertyGroup> >
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<Cultures>en-US</Cultures>
</PropertyGroup> >
Define Default User/Service Account>
<!--
The Account Name ([SERVICEACCOUNT]), Password ([SERVICEACCOUNTPASSWORD]) and Domain/Server Name ([SERVICEDOMAINNAME]) are gathered via a custom dialog. >
We can then use this default account in any area of our WiX that requires a User Account by referencing serviceAccount.
-->>
<util:UserId ='serviceAccount'Name='[SERVICEACCOUNT]'Password='[SERVICEACCOUNTPASSWORD]' Domain='[SERVICEDOMAINNAME]' ></util:User>
>
Define Default Web Site Properties>
<!-- Web site is only created if it doesn’t already exist -->>
<iis:WebSiteId='DefaultWebSite'Description='Default Web Site'>>
<iis:WebAddressId='AllUnassigned'Port='80' />>
</iis:WebSite>
>
Define Default Virtual Directory Properties>
>
<iis:WebDirPropertiesId='WebVirtualDirProperties'Execute='yes' Script='yes' Read='yes' WindowsAuthentication='no'>
AnonymousAccess='yes'AnonymousUser='serviceAccount' IIsControlledPassword='yes'/>
>
>
Create an Application Pool in IIS 6.0>
<ComponentId='C_MyAppPool'Guid='3C06911D-C31A-427E-8CA6-AEFC65161B1A' >>
<iis:WebAppPoolId='MyAppPool'Name='MyAppPool'Identity='other'User='serviceAccount' >>
</iis:WebAppPool>>
</Component>>
Create a Virtual Directory using Application Pool in Default Web Site>
>
<!--
TARGETVDIR is the name of the Virtual Directory for this site.
TARGETDIR is the directory location of the files for the site.
-->>
<PropertyId="TARGETVDIR"Value="AuthenticationWebService" />>
<ComponentId='C_VirtualDirComponent'Guid='{A598E09C-B770-4df2-BE08-E069A718B938}'>>
<iis:WebVirtualDirId='VirtualDir'Alias='[TARGETVDIR]'Directory='TARGETDIR'>
WebSite='DefaultWebSite'DirProperties='WebVirtualDirProperties' >>
<iis:WebApplicationId='WebApplication'Name='[TARGETVDIR]' WebAppPool='C_MyAppPool'/>>
</iis:WebVirtualDir>>
</Component>
>
Update an XML Configuration File>
<!--
TARGETDIR is the directory location of the files for the site.
The SERVICEENDPOINT attribute below is used to match an input control on a EnterConfigurationValuesForm dialog box (which you need to define). >
Tip: The Value attribute below can be used as a command line arguement when running the MSI from the command line. For example: >
msiexec /i C:"ActivityAuditSetup.msi SERVICEENDPOINT=http://localhost:8005/TimeStampService/service /quiet
-->>
<ComponentId="C_ConfigFile"Guid="{8943581F-D07B-49f4-AF09-23541F7EB2F7}">>
<util:XmlFileId='ModifyServiceEndPoint'Action='setValue' >
ElementPath='/configuration/system.serviceModel/client/endpoint["[]@name="S113"["]]'>
Name='address'File='[TARGETDIR]web.config'Value='http://[SERVICEENDPOINT]:8113/MyService/Service' />>
</Component>
>
>
Add a Registry Entry >
<ComponentId="C_EventLogReg"Guid="{05F254DE-E990-4FD6-86B7-11200B148B36}">>
<RegistryKeyRoot="HKLM"Key="SYSTEM"ControlSet001"Services"Eventlog"Application"Wcf_S113" >
Action="create" />>
<RegistryValueRoot="HKLM"Key="SYSTEM"ControlSet001"Services"Eventlog"Application"Wcf_S113">
Action="write"Name="EventMessageFile" Type="expandable">
Value="C:"WINDOWS"Microsoft.NET"Framework"v2.0.50727"EventLogMessages.dll"/>>
</Component>
Install a Windows Service>
>
<ComponentId="ProductComponent"Guid="{ED4F5E2A-D8B6-42e7-9330-9282AA76BB50}">>
<FileId='ServiceExeFile' Name='AuthenticationBusinessService.Hosting.exe'>
Source='Files"AuthenticationBusinessService.Hosting.exe'>
KeyPath='yes'Vital='yes'DiskId='1' /> >
<FileId='AuthenticationBusinessService.Hosting.exe.config' >
Name=' AuthenticationBusinessService.Hosting.exe.config'>
Source='Files"AuthenticationBusinessService.Hosting.exe.config'>
Vital='yes' DiskId='1' />>
>
<!-- IMPORTANT: ServiceInstall Id and Name MUST MATCH SerivceControl Id and Name -->>
<ServiceInstallId='ServiceExeFile'>
DisplayName= Authentication Business Service'Name='AuthenticationBusinessService'>
ErrorControl='normal'Start='auto'Type='ownProcess'Vital='yes'>
Description='Authentication Business Service'>
Account='[SERVICEACCOUNTUSERNAME]'Password='[SERVICEACCOUNTPASSWORD]' /> >
<ServiceControlId='ServiceExeFile'>
Name='AuthenticationBusinessService'>
Start='install'Stop='both'Remove='uninstall'Wait='yes' />>
</Component>>
Posted by Jeff Wharton at 11:42 PM
相关文章推荐
- Windows Installer XML 3.0
- WiX 技巧: 使用 MSBuild 和 Windows Installer XML 执行自动发布
- Windows Installer XML (WiX) 使用记录 (一)
- WIX 技巧-使用 MSBuild 和 Windows Installer XML 执行自动发布
- Windows Installer XML (WiX) 使用记录 (二) -- 使用内置界面
- How to Set Directory Permissions at Install Time using an MSI Created Using Windows Installer XML (WIX)
- XML and Windows CE 3.0
- 使用 MSBuild 和 Windows Installer XML 执行自动发布(转)
- Windows Installer XML Standard CustomActions
- Windows Installer XML 概述 (3)
- Windows Installer XML 概述 (2)
- 【Wix】Windows Installer Error Code
- 使用 MSBuild 和 Windows Installer XML 执行自动发布
- 在AndroidManifest.xml文件中的android:windowSoftInputMode属性使用
- Windows XP & VMware GSX 3.0下安装声卡测试
- Windows XP & VMware GSX 3.0下安装声卡测试
- Windows XP & VMware GSX 3.0下安装声卡测试
- Uninstall Camfrog Video Chat with WindowsUninstaller.Org Removal Tips
- Uninstall EasyBCD with WindowsUninstaller.Org Removal Tips
- Microsoft Office SharePoint Server 2007与Windows SharePoint Services 3.0的区别(WSS V3和MOSS2007的区别 )