zoukankan      html  css  js  c++  java
  • Visual studio 打包程序时添加自定义的系统必备组件

    Visual studio 打包程序时添加自定义的系统必备组件

    在使用Visual studio自带打包工具来制作安装包,有时需要添加自定义的系统必备组件。本文以要添加系统必备组件: Microsoft Access Database Engine 2010为例。则需要如下步骤来完成:

    1. 新建文件夹AccessDatabaseEngine,  将它放在C:Program Files (x86)Microsoft SDKsClickOnce BootstrapperPackages目录下。复制安装程序AccessDatabaseEngine.exe到此文件夹。

    2. 整个组件的文件结构如下:

    • 目录:C:Program Files (x86)Microsoft SDKsClickOnce BootstrapperPackages
      • 文件夹:AccessDatabaseEngine
        • 文件夹:en
          • package.xml
        • AccessDatabaseEngine.exe
        • product.xml

    3. 新建产品清单(product.xml) 和程序包清单(package.xml)。

    • 产品清单(product.xml)内容
    <?xml version="1.0" encoding="utf-8" ?> 
    
    <Product
      xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
      ProductCode="AccessDatabaseEngine"
    >
      <!-- Defines list of files to be copied on build -->
      <PackageFiles>
        <PackageFile Name="AccessDatabaseEngine.exe" 
          HomeSite="https://www.microsoft.com/en-us/download/confirmation.aspx?id=13255" 
          />
      </PackageFiles>
    
      <InstallChecks>
        <RegistryCheck Property="ACEValue" Key="HKLMSOFTWAREClassesMicrosoft.ACE.OLEDB.12.0"/> 
      </InstallChecks>
    
      <Commands Reboot="Defer">
        <Command PackageFile="AccessDatabaseEngine.exe">
    
          <!-- These checks determine whether the package is to be installed -->
    
          <InstallConditions>
            <!-- Comment out the below BypassIf entry if you want install the 32bit version CRRuntime redist in the target machine -->      
            <BypassIf Property="ACEValue" Compare="ValueExists"/>
    
          </InstallConditions>
    
          <ExitCodes>
            <ExitCode Value="0" Result="Success"/>
            <ExitCode Value="1641" Result="SuccessReboot"/>
            <ExitCode Value="3010" Result="SuccessReboot"/>
            <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
          </ExitCodes>
    
        </Command>
      </Commands>
    </Product>
    • 程序包清单(package.xml),该文件放在新建文件夹“en”下。
    <?xml version="1.0" encoding="utf-8" ?> 
    
    <Package
      xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
      Name="DisplayName"
      Culture="Culture"
    >
    
      <!-- Defines a localizable string table for error messages and url's  -->
      <Strings>
        <String Name="DisplayName">Access Database Engine</String>
        <String Name="Culture">en</String>
        <String Name="Anunexpected">An unexpected exit code was returned from the installer. The installation failed.</String>
        <String Name="AdminRequired">You do not have the permissions required to install this application.  Please contact your administrator.</String>
      </Strings>
    
    </Package>

    4.  在 visual studio在安装项目的系统必备组件中可以查看到新建的Access Database Engine 组件。

  • 相关阅读:
    windows下添加多个git仓库账号
    向多个git仓库提交
    (原+转)C++中的lambda表达式
    (原)使用vectot的.end()报错:iterators incompatible
    (原)使用opencv的warpAffine函数对图像进行旋转
    (原)VS2013在Release情况下使用vector有时候会崩溃的一个可能原因
    (原)Understand中查看函数调用关系
    (原+转)Ubuntu下安装understand及在启动器中增加快捷方式
    (原)测试intel的并行计算pafor
    (原)C++中测试代码执行时间
  • 原文地址:https://www.cnblogs.com/sql4me/p/13214391.html
Copyright © 2011-2022 走看看