# Cannot rebuild UWP executables that use custom app manifest

**URL:** <https://discourse.cmake.org/t/cannot-rebuild-uwp-executables-that-use-custom-app-manifest/7984>\
**Category:** Code\
**Tags:** os:windows, gen:vs\
**Created:** [April 25, 2023, 8:19pm UTC](https://discourse.cmake.org/t/cannot-rebuild-uwp-executables-that-use-custom-app-manifest/7984 "2023-04-25T20:19:22Z")\
**Posts on this page:** 1\
**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 25, 2023, 8:19pm UTC](https://discourse.cmake.org/t/cannot-rebuild-uwp-executables-that-use-custom-app-manifest/7984/1 "2023-04-25T20:19:22Z")

</div>

Consider the following CMake project that builds 2 executables with a custom UWP manifest:

```cmake
set(CMAKE_SYSTEM_NAME "WindowsStore")
set(CMAKE_SYSTEM_VERSION "10.0")

cmake_minimum_required(VERSION 3.20)
project(cmake_uwp CXX)

add_executable(target0
    # The source for the application
    main.cpp
    # The manifest
    target0.appxmanifest
    # Resources referenced in the manifest
    logo.png splash.png square-44x44.png square-150x150.png
)

add_executable(target1
    # The source for the application
    main.cpp
    # The manifest
    target1.appxmanifest
    # Resources referenced in the manifest
    logo.png splash.png square-44x44.png square-150x150.png
)

```

This project configures fine and builds fine (using the `Visual Studio xx` generators),  
but when rebuilding the following error appears:

```auto
D:\a\cmake-uwp-custom-manifest\cmake-uwp-custom-manifest\build\target0.appxmanifest : error APPX0703: Manifest references file 'target1.exe' which is not part of the payload. [D:\a\cmake-uwp-custom-manifest\cmake-uwp-custom-manifest\build\target0.vcxproj]
  target1.vcxproj -> D:\a\cmake-uwp-custom-manifest\cmake-uwp-custom-manifest\build\Debug\target1.exe
  target1 -> D:\a\cmake-uwp-custom-manifest\cmake-uwp-custom-manifest\build\AppPackages\target1\target1_1.0.0.0_x64_Debug_Test\target1_1.0.0.0_x64_Debug.msix

```

Somehow, `target0.appxmanifest` is referencing `target1.exe`, even though they are part of different targets.

I’ve created this repo that reproduces the issue:

> **[GitHub - madebr/cmake-uwp-custom-manifest: Custom manifest for multiple...](https://github.com/madebr/cmake-uwp-custom-manifest)**
>
> Custom manifest for multiple executables. Contribute to madebr/cmake-uwp-custom-manifest development by creating an account on GitHub.

In the [CI output](https://github.com/madebr/cmake-uwp-custom-manifest/actions/runs/4801583638/jobs/8543985316), you can see the executables build fine initially, but fail to rebuild the 2nd time.
