首页 > 解决方案 > 如何在 Windows 应用程序打包项目的 MSIX 文件中包含生成的应用程序清单

问题描述

我正在编写一个需要使用包标识部署的 VB.NET Windows 窗体应用程序,因此我正在为其生成 MSIX 文件。我希望应用程序启用高 DPI,因此我在 app.manifest 中设置了所需的密钥。在构建应用程序并在没有 MSIX 打包的情况下运行它时,高 DPI 支持工作正常。通过 Windows 应用程序打包项目构建和运行 MSIX 打包时,高 DPI 支持不起作用。(我之前曾尝试在 app.config 中指定高 DPI 支持,但显然这会禁用 VB.NET 应用程序的视觉样式,我宁愿不禁用应用程序框架来尝试解决问题。)

生成的应用清单文件似乎未包含在 MSIX 文件中。我怎样才能包含这个文件。

没有 MSIX 打包的调试构建目录的内容:

10/14/2020  05:27 PM    <DIR>          .
10/14/2020  05:27 PM    <DIR>          ..
10/14/2020  05:27 PM    <DIR>          app.publish
03/19/2019  12:46 AM           160,160 System.Runtime.WindowsRuntime.dll
03/19/2019  12:46 AM            72,096 System.Runtime.WindowsRuntime.UI.Xaml.dll
10/22/2018  08:48 PM            24,064 Windows.Foundation.FoundationContract.winmd
10/22/2018  08:48 PM         5,612,032 Windows.Foundation.UniversalApiContract.winmd
08/09/2018  05:44 PM           174,080 windows.winmd
10/14/2020  05:27 PM             1,899 MyApp.application
10/14/2020  05:21 PM            24,064 MyApp.exe
10/13/2020  03:31 PM               369 MyApp.exe.config
10/14/2020  05:27 PM             6,371 MyApp.exe.manifest
10/14/2020  05:21 PM            54,784 MyApp.pdb
10/14/2020  05:21 PM               727 MyApp.xml
              11 File(s)      6,130,646 bytes
               3 Dir(s)   7,844,708,352 bytes free

我的带有 MSIX 打包的调试构建目录的内容:

10/14/2020  05:16 PM    <DIR>          .
10/14/2020  05:16 PM    <DIR>          ..
03/19/2019  12:46 AM           160,160 System.Runtime.WindowsRuntime.dll
03/19/2019  12:46 AM            72,096 System.Runtime.WindowsRuntime.UI.Xaml.dll
10/14/2020  05:16 PM            24,064 MyApp.exe
10/13/2020  03:31 PM               369 MyApp.exe.config
10/14/2020  05:16 PM            54,784 MyApp.pdb
               5 File(s)        311,473 bytes
               2 Dir(s)   7,842,045,952 bytes free

MyApp.exe.manifest似乎没有包含在 MSIX 包中,我想包含它。我将如何在 Windows 应用程序打包项目中这样做?

Visual Studio 2019 社区 16.7.6、.NET Framework 4.8、Windows 10 版本 1909。

谢谢!

标签: .netwindowsvb.netwinformsmsix

解决方案


推荐阅读