Xamarin:用于不同构建配置的不同 appxmanifest 文件 [英] Xamarin: Different appxmanifest files for different build configurations

查看:54
本文介绍了Xamarin:用于不同构建配置的不同 appxmanifest 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对某些构建配置使用不同的 Package.appxmanifest 文件.我的 Xamarin-UWP 项目中不能包含多个 appxmanifest 文件.像 Android 那样做的想法也行不通:

I want to use different Package.appxmanifest files for some build configurations. I cannot include more than one appxmanifest-file into my Xamarin-UWP project. And ideas like doing it like Android also doesn't work:

处理多个 AndroidManifest 文件:

Working for multiple AndroidManifest files:

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release-CH|AnyCPU'">
…
<AndroidManifest>Properties\AndroidManifestCH.xml</AndroidManifest>
</PropertyGroup>

我如何为 UWP 实现这一目标?

How can I achive this for UWP?

推荐答案

像 Android 那样做的想法也行不通

And ideas like doing it like Android also doesn't work

根据应用包清单,每个应用包必须包含一个包清单.如果在uwp中新建一个appxmanifest文件,会报错如下.

According to App package manifest, Every app package must include one package manifest. If you create a new appxmanifest file in the uwp, it will throw error like the follow.

该项目包含代表应用清单的 2 个项目:Package.appxmanifest、Test.appxmanifest.项目只能包含一个应用清单

The project contains 2 items that represent the app manifest: Package.appxmanifest, Test.appxmanifest. The project can contain only one app manifest

如果您确实想对某些构建配置使用不同的 Package.appxmanifest 文件.您可以手动编辑 FileGuidTest.csproj.

If you do want to use different Package.appxmanifest files for some build configurations. you could edit FileGuidTest.csproj manually.

右键单击项目-> 卸载项目-> 重新右键单击项目-> 编辑 Project.csproj 文件.

Right Click Project-> Unload Project-> Re-Right Click Project-> Edit Project.csproj file.

<ItemGroup>
  <AppxManifest Include="Package.appxmanifest">
    <SubType>Designer</SubType>
  </AppxManifest>
  <AppxManifest Include="app.appxmanifest">
    <SubType>Designer</SubType>
  </AppxManifest>
  <None Include="FileGuidTest_TemporaryKey.pfx" />
  <AppxManifest Include="Test.appxmanifest">
    <SubType>Designer</SubType>
  </AppxManifest>
</ItemGroup>

找出上面的ItemGroup节点,只保留一个AppxManifest.然后修改下面的PropertyGroup节点.

Find out the above ItemGroup node and reserve only one AppxManifest. And then modify the follow PropertyGroup node.

<PropertyGroup>
  <ApplicationManifest>Package.appxmanifest</ApplicationManifest>
</PropertyGroup>

这篇关于Xamarin:用于不同构建配置的不同 appxmanifest 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆