惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Jina AI
Jina AI
博客园 - 【当耐特】
量子位
C
Check Point Blog
博客园 - 叶小钗
博客园 - 聂微东
博客园 - 三生石上(FineUI控件)
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
The Cloudflare Blog
T
Tailwind CSS Blog
人人都是产品经理
人人都是产品经理
月光博客
月光博客
V
V2EX
Last Week in AI
Last Week in AI
酷 壳 – CoolShell
酷 壳 – CoolShell
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
IT之家
IT之家
大猫的无限游戏
大猫的无限游戏
有赞技术团队
有赞技术团队
Apple Machine Learning Research
Apple Machine Learning Research
S
SegmentFault 最新的问题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - JerryZhao

[转载]jQuery对象VS DOM对象 [Reference] Navigation on Matrix Subtotal [Refereces]Creating an .ini File for the Application Manager [Refereces] Developing and Deploying Pocket PC Setup Applications [References]More on device app installs - Installing a Windows Mobile device application from a desktop MSI [References]Deploying .NET Compact Framework 2.0 Applications with .cab and .msi Files [References]Installing Multiple CAB Files [Reference]Wix Restart IIS code snippet [Reference] Casle Demo App: Midway Summary [ActiveRecord] 之五:ActiveRecordMediator [Reference][ActiveRecord] 之四:Cascade [Reference][ActiveRecord] 之六:继承 [Referece][ActiveRecord] 之七:多数据库配置 [Reference] [Castle AR] 5. Base Relations [Reference][Castle AR] 3. Validate [Reference][Castle AR] 2. ActiveRecord [Reference][Castle AR] 1. Starter [reference][Castle AR] 4. CRUD [Reference]NHibernateDataSource: A DataSourceControl for ASP.NET 2.0
[Reference] Windows Installer XML (WiX) 3.0 Snippets
JerryZhao · 2008-02-07 · via 博客园 - JerryZhao

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>