前提條件檢查
的先決條件是,
- Visual Studio 2008 IDE安裝。
- Dotnet Framework 2.0運行時間
- GAX安裝。
要檢查這些,引用這些兩個DLL:
- WixNetFxExtension(大多是從C:\ Program Files文件\的Windows Installer XML V3 \ BIN \ WixNetFxExtension.dll)
- WixUIExtension(主要是由C :\ Program Files文件\的Windows Installer XML V3 \ BIN \ WixUIExtension.dll)
,並如下圖所示添加先決條件,你.wxs文件。
<!-- Dotnet 2.0 framework installation check - START -->
<PropertyRef Id="NETFRAMEWORK20" />
<Condition Message="Framework 2.0 is required for the setup to continue."><![CDATA[INSTALLED or NETFRAMEWORK20]]></Condition>
<!-- Dotnet 2.0 framework installation check - END -->
<!-- VS.NET and VS.C# installation check - START -->
<Property Id="VCSHARP">
<RegistrySearch Id="VCShaprp" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\9.0\InstalledProducts\Microsoft Visual C#" Name="Package" Type="raw" />
</Property>
<Condition Message="Please install Visual C# with Visual Studio 2008 to continue. Setup will now abort."><![CDATA[INSTALLED or VCSHARP]]></Condition>
<!-- VS.NET and VS.C# installation check - END -->
<!-- GAX for VS.2008 installation check - START -->
<Property Id="GAX">
<RegistrySearch Id="gax" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\9.0\InstalledProducts\RecipeManagerPackage" Name="Package" Type="raw" />
</Property>
<Condition Message="Please install Guidance Automation Extension on Visual Studio 2008 to continue. Setup will now abort."><![CDATA[INSTALLED OR GAX]]></Condition>
<!-- GAX for VS.2008 installation check - END -->
<!-- Pre-requisite check - END -->
安裝文件夾
定義運行時安裝文件夾的設置。這link將幫助你回答你所有的「如何」。
運行安裝程序
你有如下修改InstallerClass。
[System.ComponentModel.ToolboxItem(false)]
[RunInstaller(true)]
public class InstallerClass : ManifestInstaller
{
public InstallerClass()
: base()
{ }
public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);
}
public override void Commit(System.Collections.IDictionary savedState)
{
base.Commit(savedState);
}
public override void Rollback(System.Collections.IDictionary savedState)
{
base.Rollback(savedState);
}
}
沒有這個維克斯安裝程序會拋出異常說不類被標記爲「runInstaller的」
這一點,你可以使用下面維克斯元素installutil.exe運行運行安裝程序類之後。
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallInitialize" />
<Custom Action="ManagedInstall" After="InstallFinalize" >NOT Installed</Custom>
<Custom Action="ManagedUnInstall" After="InstallInitialize">Installed AND NOT UPGRADINGPRODUCTCODE</Custom>
</InstallExecuteSequence>
<CustomAction Id="ManagedInstall"
Directory='INSTALLLOCATION'
ExeCommand='"[WindowsFolder]Microsoft.NET\Framework\v2.0.50727\installUtil.exe" /LogToConsole=false /DesignMode /hive=9.0 /Configuration="[INSTALLLOCATION]Guidance.xml" "[INSTALLLOCATION]PackageInstaller2008.dll"'
Return='check' >
</CustomAction>
<CustomAction Id="ManagedUnInstall"
Directory='INSTALLLOCATION'
ExeCommand='"[WindowsFolder]Microsoft.NET\Framework\v2.0.50727\installUtil.exe" /u /LogToConsole=false /DesignMode /hive=9.0 /Configuration="[INSTALLLOCATION]Guidance.xml" "[INSTALLLOCATION]PackageInstaller2008.dll"'
Return='check' >
</CustomAction>
希望這會有所幫助。