Visual studio2019 ClickOnce打包添加自

2021-05-21  本文已影响0人  醉酒的姑娘

创建ClickOnce引导程序必备安装组件,如图

image
image.png

若要创建引导程序包,必须创建产品清单

产品清单 product.xml

包清单 package.xml

在创建这两个文件之后,请将产品清单文件放置在一个依据自定义引导程序命名的文件夹中。程序包清单文件将放置到一个依据区域设置命名的文件夹中。 例如,如果程序包清单文件针对的是英语版的再发行程序,请将该文件放置在一个名为 en 的文件夹中。 对于每个区域设置(如 ja 代表日语,de 代表德语)最终的自定义引导程序包的文件夹结构将如下所示。

MicrosoftEdgeWebview2Setup  product.xml
  CustomBootstrapper.msi
  de
    package.xml
  en
    package.xml
  ja
    package.xml

image

然后,将文件复制到引导程序文件夹位置C:\Program Files (x86)\Microsoft Visual Studio 14.0\SDK\Bootstrapper\Packages文件夹下,如图

image

在将这些文件复制到引导程序文件夹中之后,相应的引导程序包将自动出现在 Visual Studio 的“系统必备”对话框中。

product.xml

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

<Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" ProductCode="MicrosoftEdgeWebview2Setup">

  <!-- Defines list of files to be copied on build -->
  <PackageFiles CopyAllPackageFiles="false">
    <PackageFile Name="MicrosoftEdgeWebview2Setup.exe"
                 HomeSite="https://go.microsoft.com/fwlink/p/?LinkId=2124703"
                 PublicKey="0" />
  </PackageFiles>

  <!-- Run the NetCoreCheck tool that will determine if the necessary framework is installed -->

  <!-- Defines how to invoke the setup for the .Net Desktop Runtime 3.1 -->
  <Commands Reboot="Defer">
    <Command PackageFile="MicrosoftEdgeWebview2Setup.exe" >

      <!-- These checks determine whether the package is to be installed -->
      <InstallConditions>

        <!-- Block install on less than Windows 7 RTM -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="6.1.0" String="InvalidPlatformWinNT"/>
        <!-- NetCoreCheck returning 0 means the runtime is already installed -->
        <BypassIf Property="NetCoreCheck" Compare="ValueEqualTo" Value="0"/>
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
      </InstallConditions>

      <ExitCodes>
        <ExitCode Value="0" Result="Success"/>
        <ExitCode Value="3010" Result="SuccessReboot"/>
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>

    </Command>
  </Commands>
</Product>

package.xml

<?xml version="1.0" encoding="utf-8" ?>
<Package
  xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
  Name="DisplayName"
  Culture="Culture"
>

  <Strings>
    <String Name="DisplayName">MicrosoftEdgeWebview2Setup</String>
    <String Name="Culture">en</String>
    <String Name="NotAnAdmin">You must be an administrator to install this package.</String>
    <String Name="GeneralFailure">A general error has occurred while
installing this package.</String>
  </Strings>
</Package>
上一篇 下一篇

猜你喜欢

热点阅读