# Building multiple WinRT executables with custom appxmanifests in one cmake script fails

**URL:** https://discourse.cmake.org/t/building-multiple-winrt-executables-with-custom-appxmanifests-in-one-cmake-script-fails/7936
**Category:** Code
**Tags:** os:windows, comp:msvc, gen:vs
**Created:** [April 19, 2023, 11:18pm UTC](https://discourse.cmake.org/t/building-multiple-winrt-executables-with-custom-appxmanifests-in-one-cmake-script-fails/7936 "2023-04-19T23:18:13Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![amaarten](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/0ea827/32.png) [@amaarten](https://discourse.cmake.org/u/amaarten)
#### Post date: [April 19, 2023, 11:18pm UTC](https://discourse.cmake.org/t/building-multiple-winrt-executables-with-custom-appxmanifests-in-one-cmake-script-fails/7936/1 "2023-04-19T23:18:13Z")

</div>

Building a project that builds multiple UWP executables with all having a custom manifest fails.

Consider [this cmake project](https://github.com/madebr/cmake-uwp-custom-manifest) that creates multiple executables, all having custom app manifests.  
Configuring and building the project on the console fails because the image assets could not be found.

```auto
> cmake -S . -B build -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.0 -Dnumber_targets=2
...
> cmake --build build
...
C:\Users\maarten\source\repos\scratch-uwp\build\target0.appxmanifest(22,97): error APPX0703: Manifest
 references file 'square-150x150.png' which is not part of the payload. [C:\Users\maarte
n\source\repos\scratch-uwp\build\target0.vcxproj]
C:\Users\maarten\source\repos\scratch-uwp\build\target0.appxmanifest(22,149): error APPX0703: Manifes
t references file 'square-44x44.png' which is not part of the payload. [C:\Users\maarten
\source\repos\scratch-uwp\build\target0.vcxproj]
C:\Users\maarten\source\repos\scratch-uwp\build\target0.appxmanifest(23,27): error APPX0703: Manifest
 references file 'splash.png' which is not part of the payload. [C:\Users\maarten\sou
rce\repos\scratch-uwp\build\target0.vcxproj]
...

```

When I remove the build folder, reconfigure and open the project in Visual Studio,  
I can build the targets only once.

```auto
> rd /s /q build
> cmake -S . -B build -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.0 -Dnumber_targets=2
...
> cmake --open build

```

1. Build target0 first: this should succeed.
  1. Rightclick on target0
  2. Click on Build

2. Then, build target1: this succeeds as well.
  1. Rightclick on target 1
  2. Click on Build

3. Build target0 again: this fails!
  1. Rightclick on target0
  2. Click on Build

The output window shows a message that suggests `target0.appxmanifest` references `target1.exe`, which it does _not_.

```auto
Build started...
1>------ Build started: Project: target0, Configuration: Debug x64 ------
1>target0.vcxproj -> C:\Users\maarten\source\repos\scratch-uwp\build\Debug\target0.exe
1>C:\Users\maarten\source\repos\scratch-uwp\build\target0.appxmanifest : error APPX0703: Manifest references file 'target1.exe' which is not part of the payload.
1>Done building project "target0.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

```

Am I doing something wrong?

System information:

```auto
>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30148 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

usage: cl [option...] filename... [/link linkoption...]
>ver

Microsoft Windows [Version 10.0.19044.2846]
>msbuild
Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
>devenv

Microsoft Visual Studio 2019 Version 16.11.26.
Copyright (C) Microsoft Corp. All rights reserved.

```

---

<div class="post-metadata">

### Author: ![amaarten](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/0ea827/32.png) [@amaarten](https://discourse.cmake.org/u/amaarten)
#### Post date: [April 25, 2023, 8:08pm UTC](https://discourse.cmake.org/t/building-multiple-winrt-executables-with-custom-appxmanifests-in-one-cmake-script-fails/7936/2 "2023-04-25T20:08:23Z")

</div>

I apparently screwed up embedded images that caused the build to fail.  
After fixing the image sizes, the issue of not being able to rebuild the executables remain.  
I will open a new thread for this as the reproducer has become much easier.
