部署 wpf 应用程序时包含 .exe 文件

Include .exe file when deploying wpf application

我正在创建一个也使用 Kinect 2 的 WPF 应用程序。现在是发布我的应用程序的时候了,我想创建一个唯一的安装文件来安装该应用程序和 Kinect SDK。我有 Kinect .exe,我想将它包含在我使用 Visual studio 中的发布选项创建的标准设置中(顺便说一句,我使用的是 Visual Studio 2017)。 阅读一些资料后,我发现正确的方法可能是将 Kinect SDK 插入到我的应用程序的先决条件中。正确的? 因此,我正在尝试按照以下指南添加文件:

How to: Create a Package Manifest

How to: Create a Product Manifest

我在 C:\Program Files (x86)\Microsoft Visual Studio14.0\SDK\Bootstrapper\Packages 中创建了一个文件夹,我添加了产品 xml 文件:

<?xml version="1.0" encoding="utf-8" ?>
<Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
ProductCode="Custom.Bootstrapper.Package">  
<PackageFiles>  
   <PackageFile Name="KinectRuntime-v2.0_1409-Setup.exe"/>  
</PackageFiles>
<Commands>  
<Command PackageFile="KinectRuntime-v2.0_1409-Setup.exe" Arguments="">  
<InstallConditions>  
    <BypassIf Property="IsMsiInstalled"  
      Compare="ValueGreaterThan" Value="0"/>  
    <FailIf Property="AdminUser"   
      Compare="ValueNotEqualTo" Value="True"  
     String="NotAnAdmin"/>  
  </InstallConditions>  

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


然后在名为 "en" 的子文件夹中,我添加了包 xml 文件:

<Package xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
    Name="DisplayName"  
    Culture="Culture"  
    LicenseAgreement="SDKEula.rtf">  
<PackageFiles>  
   <PackageFile Name="SDKEula.rtf"/>  
</PackageFiles>  

 <!-- Defines a localizable string table for error messages. -->  
 <Strings>  
     <String Name="DisplayName">Update Consent Dialog</String>  
     <String Name="Culture">en</String>  
     <String Name="AU_Unaccepted">The automatic update agreement is not accepted.
     </String>  
<String Name="GeneralFailure">A failure occurred attempting to launch the setup.</String>  
</Strings>  
</Package>`

我还添加了 rtf 文件。所以对我来说应该差不多好了。但是当我回到 VS 时,我没有在先决条件列表中看到这个新包。 你能帮我添加 Kinect SDK 安装程序吗? 非常感谢你, 亚历克斯

已解决。我认为该文件夹是正确的,但查看密钥 GenericBootstrapper 我发现包的路径是 C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper。在文件夹中添加带有产品和包 xml 的新包,我能够在先决条件中看到 Kinect 安装程序。发布APP一切正常