Bootstrap Manifest Generator(BMG) 生成的product.xml 试分析

来源:互联网 发布:plc温度控制编程实例 编辑:程序博客网 时间:2024/06/09 22:58

BMG是一个应用于ClickOnce发布中自制系统必备包的图形化工具。ClickOnce的系统必备包放在C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\(VS2008)。通过BMG我们可以自行定义包括第三方组件在内的安装方案。以下是通过比对VS2008自带Packages,对product.xml的试分析。


定制的product.xml内容如下:


 <?xml  version="1.0" encoding="utf-8" ?>

<Productxmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"ProductCode="Microsoft.Net.Framework.2.0(显示在ClickOnce系统必备中的名称">


<RelatedProducts>(关联安装包
 <IncludesProductCode(包含方式,另外还有一种Depend依赖方式)="Microsoft.Windows.Installer.2.0"/>
 </RelatedProducts>
-<!--Defines list of files to be copied on build  -->
<PackageFilesCopyAllPackageFiles="false">(为True的话是每次安装都下载全部系统必备安装包
 <PackageFileName="instmsia.exe"HomeSite="InstMsiAExe"PublicKey=""/>
 <PackageFileName="WindowsInstaller-KB893803-v2-x86.exe"HomeSite=""/>
 <PackageFileName="dotnetfx.exe"HomeSite="DotNetFXExe"PublicKey=""/>

 <PackageFileName="dotnetchk.exe"/> (这个小工具是检查客户机是否安装dotnetframwork

必备安装包内共四个文件

 </PackageFiles>
<InstallChecks>(安装前进行检查
 <ExternalCheck Property="DotNetInstalled"PackageFile="dotnetchk.exe"/>(外部程序检查,若本机安装dotnet,则退出代码为"DotNetInstalled"

 <RegistryCheck Property="IEVersion"Key="HKLM\Software\Microsoft\Internet Explorer"Value="Version"/>(注册表检查

另外还有 AssemblyCheck(检查GAC中是否有指定的程序集)、FileCheck(检查指定文件是否存在)、MsiProductCheck(检查指定的 Microsoft Windows Installer 安装是否已运行完毕)

 </InstallChecks>

以上为全局检查,也可以每个包内组件各自检查。

-<!--Defines how to invoke the setup for the .NET Framework redist  -->
<CommandsReboot="Immediate">(若指定Reboot,则立即重启
<CommandPackageFile="instmsia.exe"Arguments="/q /c:"msiinst /delayrebootq"(可带参数运行安装组件"EstimatedInstallSeconds="20">
<InstallConditions>(安装条件
 <BypassIfProperty="VersionNT"Compare="ValueExists"/> (这句的意思是检查NT版本,若存在则通过
 <BypassIfProperty="VersionMsi"Compare="VersionGreaterThanOrEqualTo"Value="2.0"/>(若MSI安装器的版本大于等于2.0则通过
 </InstallConditions>
<ExitCodes>
 <ExitCodeValue="0"Result="SuccessReboot"/> (退出代码为0,则返回提示成功并重启
 <ExitCodeValue="1641"Result="SuccessReboot"/>
 <ExitCodeValue="3010"Result="SuccessReboot"/>
 <DefaultExitCodeResult="Fail"FormatMessageFromSystem="true"String="GeneralFailure"/>
 </ExitCodes>

 </Command>

以上为一个安装组件的配置——每个Command标签一个安装组件,下同。

<CommandPackageFile="WindowsInstaller-KB893803-v2-x86.exe"Arguments="/quiet  /norestart"EstimatedInstallSeconds="21">
<InstallConditions>
 <BypassIfProperty="Version9x"Compare="ValueExists"/>
 <BypassIfProperty="VersionNT"Compare="VersionLessThan"Value="5.0.3"/>
 <BypassIfProperty="VersionMsi"Compare="VersionGreaterThanOrEqualTo"Value="3.0"/>
 <FailIfProperty="AdminUser"Compare="ValueEqualTo"Value="false"String="AdminRequired"/>
 </InstallConditions>
<ExitCodes>
 <ExitCodeValue="0"Result="Success"/>
 <ExitCodeValue="1641"Result="SuccessReboot"/>
 <ExitCodeValue="3010"Result="SuccessReboot"/>
 <DefaultExitCodeResult="Fail"FormatMessageFromSystem="true"String="GeneralFailure"/>
 </ExitCodes>
 </Command>
<CommandPackageFile="dotnetfx.exe"Arguments="/q:a /c:"install /q /l""EstimatedInstalledBytes="180000000"EstimatedTempBytes="110000000"EstimatedInstallSeconds="420">
-<!--These checks determine whether the package is to be installed  -->
<InstallConditions>
-<!--Either of these properties indicates the .Net Framework is already installed  -->
 <BypassIfProperty="DotNetInstalled"Compare="ValueNotEqualTo"Value="0"/>
-<!--Block install if user does not have admin privileges  -->
 <FailIfProperty="AdminUser"Compare="ValueEqualTo"Value="false"String="AdminRequired"/>
-<!--Block install on Windows 95  -->
 <FailIfProperty="Version9x"Compare="VersionLessThan"Value="4.10"String="InvalidPlatformWin9x"/>
-<!--Block install on Windows 2000 SP 2 or less  -->
 <FailIfProperty="VersionNT"Compare="VersionLessThan"Value="5.0.3"String="InvalidPlatformWinNT"/>
-<!--Block install if IE 5.01 or greater is not present  -->
 <FailIfProperty="IEVersion"Compare="ValueNotExists"String="InvalidPlatformIE"/>
 <FailIfProperty="IEVersion"Compare="VersionLessThan"Value="5.0.2900"String="InvalidPlatformIE"/>
-<!--Block install if the platform is not x86  -->
 <FailIfProperty="ProcessorArchitecture"Compare="ValueNotEqualTo"Value="Intel"String="InvalidPlatformArchitecture"/>
 </InstallConditions>
<ExitCodes>
 <ExitCodeValue="0"Result="Success"/>
 <ExitCodeValue="3010"Result="SuccessReboot"/>
 <ExitCodeValue="4097"Result="Fail"String="AdminRequired"/>
 <ExitCodeValue="4099"Result="Fail"String="WindowsInstallerImproperInstall"/>
 <ExitCodeValue="4101"Result="Fail"String="AnotherInstanceRunning"/>
 <ExitCodeValue="4113"Result="Fail"String="BetaNDPFailure"/>
 <DefaultExitCodeResult="Fail"FormatMessageFromSystem="true"String="GeneralFailure"/>
 </ExitCodes>
 </Command>
 </Commands>

 </Product>


BMG下载地址

BMG截图

0 0
原创粉丝点击