0

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:

Working for multiple AndroidManifest files:

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

How can I achive this for UWP?

Brandon Minnick
  • 13,342
  • 15
  • 65
  • 123
Konrad
  • 4,329
  • 10
  • 54
  • 88

1 Answers1

2

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

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.

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

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

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>

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

<PropertyGroup>
  <ApplicationManifest>Package.appxmanifest</ApplicationManifest>
</PropertyGroup>
Nico Zhu
  • 32,367
  • 2
  • 15
  • 36
  • Doesn't work. I added in about 10 PropertyGroups: Package.appxmanifest ... and in the one with the wanted condition: PackageCH.appxmanifest ... additional I added both files in an ItemGroup (that isn't part of any of the PropertyGropus): ... – Konrad Dec 18 '17 at 15:19
  • Both `ItemGroup` and `PropertyGroup` have only one element. – Nico Zhu Dec 19 '17 at 01:35
  • That seems to work. But although the PackageCH.appxmanifest is not part of an ItemGroup (but in one PropertyGroup), it is shown as a project file in the visual tree view of the project. – Konrad Dec 19 '17 at 09:07