在 Windows 10 Desktop Bridge 中将多个可执行项目设置为公共输出路径

Set multiple executable projects to a common output path in Windows 10 Desktop Bridge

我正在寻找一种方法将我所有的“应用程序”引用合并到 AppX 包内的一个公共目录中。引用的项目类型是标准的 Visual C++ (Win32) 项目。我的解决方案的当前结构如下:

解决方案结构

* Solution
|__ Exe_1 (Visual C++ Project)
|__ Exe_2 (Visual C++ Project)
|__ Exe_3 (Visual C++ Project)
|
|__ MyApp (AppX Project)
    |__ Applications
    |   |__ Exe_1
    |   |__ Exe_2
    |   |__ Exe_3
    |___ Images\
    |___ Package.appxmanifest     

发布解决方案并部署 AppX 包后,我得到以下目录结构:

[实际]已部署的 AppX 目录结构

Com.MyApp.12107._cx40ttqa_n3.48019.0_x64zyj5
|__ Exe_1\Exe_1.exe
|__ Exe_2\Exe_2.exe
|__ Exe_3\Exe_3.exe

[预期]已部署的 AppX 目录结构

Com.MyApp.12107._cx40ttqa_n3.48019.0_x64zyj5
|__ Exe_1.exe
|__ Exe_2.exe
|__ Exe_3.exe

我试过的

我想达到的目标

与 Apple 设法将 iTunes 的相关文件打包到根应用程序目录中的结果类似。


更新#1

我编辑了 AppX 项目中的 MyApp.wapproj 文件并修改了以下行:

<ProjectReference Include="..\Exe_1\Exe_1.vcxproj">
  <OutputItemType>Content</OutputItemType>
  <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</ProjectReference>

通过手头的修改,EXE 现在 被复制但不用作真正的入口点。这种情况类似于Post-Build Event 方法。

截至撰写本文时,Visual Studio 2019 (v16.6.4) 不提供用于更改引用“应用程序”的输出路径的内置选项。或者,您必须撤销项目中的所有应用程序引用,并在 .wapproj 项目文件中的资产导入下附加以下内容:

<Content Include="..\Path\To\Your\Exe_1\Exe_1.exe" />
<Content Include="..\Path\To\Your\Exe_2\Exe_2.exe" />
<Content Include="..\Path\To\Your\Exe_3\Exe_3.exe" />

此外,您需要将标签 <EntryPointProjectUniqueName> 替换为 <EntryPointExe>,因为我们不再处理引用的应用程序(至少在作者的情况下是这样。)

<EntryPointExe>..\Path\To\Your\Exe_1\Exe_1.exe</EntryPointExe>

最终,您将在部署到机器上后获得与作者预期类似的输出。


来自微软的反馈

As you can imagine there is a reason that we do this and the primary concern is duplicate filenames as well as some issues with uploading to the store. As of now there is no override that we provide that will allow you to achieve this although there are some hacks you could do to make it possible but it is not advised.​

Scoban [MSFT]

讨论可见here.