Wix ToolSet 初體驗


Wix ToolSet Version: 3.11.2

Visual Studio: 2015

1. 創建1個WPF項目, 項目名稱Practice1

 

 

 2. 創建Wix Toolset項目,項目名稱Setup1

 

 

 

 

3. 引用"Practice1"項目到"Setup1"中

官方文檔的步驟如下

To add a project reference to a WiX project:

  1. Right-click on the References node of the project in the Solution Explorer and choose Add Reference....
  2. In the Add Reference dialog, click on the Projects tab.
  3. Select the desired project(s) and click the Add button, and then press OK to dismiss the dialog. 

 

 

 

 

 

4. 添加項目到組件中 

 

 

 

5. Output 

右鍵Setup1, Build, 會生成Setup1.msi的安裝包

 

安裝包安裝, 會在c盤program file下生成一個執行程序. 

 

這邊安裝的路徑由下面的片段決定

 

 

6. ComponentGroup-> Component-> File的說明: 

Supported Project Reference Variables

Once a project reference is added, a list of project variables becomes avaliable to be referenced in the WiX source code. Project reference variables are useful when you do not want to have hard-coded values. For example, the $(var.MyProject.ProjectName) variable will query the correct project name at build time even if I change the name of the referenced project after the reference is added.

The following demonstrates how to use project reference variables in WiX source code:

<File Id="MyExecutable" Name="$(var.MyProject.TargetFileName)" Source="$(var.MyProject.)" DiskId="1" />

The WiX project supports the following project reference variables:

Variable name

Example usage

Example value

var.ProjectName.Configuration

$(var.MyProject.Configuration)

Debug or Release

var.ProjectName.FullConfiguration

$(var.MyProject.FullConfiguration)

Debug|AnyCPU

var.ProjectName.Platform

$(var.MyProject.Platform)

AnyCPU, Win32, x64 or ia64

var.ProjectName.ProjectDir

$(var.MyProject.ProjectDir)

C:\users\myusername\Documents\Visual Studio 2010\Projects\MyProject\

var.ProjectName.ProjectExt

$(var.MyProject.ProjectExt)

.csproj

var.ProjectName.ProjectFileName

$(var.MyProject.ProjectFileName)

MyProject.csproj

var.ProjectName.ProjectName

$(var.MyProject.ProjectName)

MyProject

var.ProjectName.ProjectPath

$(var.MyProject.ProjectPath)

C:\users\myusername\Documents\Visual Studio 2010\Projects\MyProject\MyApp.csproj

var.ProjectName.TargetDir

$(var.MyProject.TargetDir)

C:\users\myusername\Documents\Visual Studio 2010\Projects\MyProject\bin\Debug\

var.ProjectName.TargetExt

$(var.MyProject.TargetExt)

.exe

var.ProjectName.TargetFileName

$(var.MyProject.TargetFileName)

MyProject.exe

var.ProjectName.TargetName

$(var.MyProject.TargetName)

MyProject

var.ProjectName.TargetPath

$(var.MyProject.TargetPath)

C:\users\myusername\Documents\Visual Studio 2010\Projects\MyProject\bin\Debug\MyProject.exe

var.ProjectName.Culture.TargetPath

$(var.MyProject.en-US.TargetPath)

C:\users\myusername\Documents\Visual Studio 2010\Projects\MyProject\bin\Debug\en-US\MyProject.msm

var.SolutionDir

$(var.SolutionDir)

C:\users\myusername\Documents\Visual Studio 2010\Projects\MySolution\

var.SolutionExt

$(var.SolutionExt)

.sln

var.SolutionFileName

$(var.SolutionFileName)

MySolution.sln

var.SolutionName

$(var.SolutionName)

MySolution

var.SolutionPath

$(var.SolutionPath)

C:\users\myusername\Documents\Visual Studio 2010\Projects\MySolution\MySolution.sln

Note: var.ProjectName.Culture.TargetPath is only available for projects that have multiple localized outputs (e.g. MSMs).

 

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM