microsoft / microsoft/WindowsAppSDK
WAP project with WindowsAppSDKSelfContained=true will have conflict with WinRTCOMServer project & CsWinRT project
- Dominant language
- C++
- Stars
- 4.7k
- Forks
- 471
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 28
Description
### Describe the bug
WAP project will place all referenced project into separate output directory if `WindowsAppSDKSelfContained` set to false
```
WAP_Output_Directory
├── CsWinRTProject // for example: IBackgroundTask
│ ├── ......
└── WinRTCOMServer
├── ......
```
Things changed if `WindowsAppSDKSelfContained` set to true. WAP project will place all referenced project into same output directory.
```
WAP_Output_Directory
├── ...... (CsWinRTProject)
└── ...... (WinRTCOMServer)
```
Consider a scenario:
CsWinRTProject
```xml
true
CsWinRTProject
true
$(TargetWindowsVersion)
all
runtime; build; native; contentfiles; analyzers; buildtransitive
```
WinRTCOMServer
```xml
WinExe
true
true
true
false
true
WinRTCOMServer
true
true
true
$(TargetWindowsVersion)
true
true
Speed
all
runtime; build; native; contentfiles; analyzers; buildtransitive
all
runtime; build; native; contentfiles; analyzers; buildtransitive
```
if CsWinRTProject outputs a .dll file but WinRTCOMServer outputs an exe file. However, WinRTCOMServer build with `SelfContained=true`, but CsWinRTProject isn't. Setting`WindowsAppSDKSelfContained=true` on WAP project will force those two projects being placed on same directory instead of place them into separate directory. Which cause conflict and might override files with same name.
To run CsWinRTProject using `backgroundTaskHost.exe` require the CsWinRTProject must not SelfContained. Due to the conflict, I believe CsWinRTProject's WinRT.Host.dll might be overrided by the WinRTCOMServer and therefore, it was changed and will run in SelfContained mode.
> backgroundtaskhost initialization for self-contained components is not supported
**Workaround:**
Set `WindowsAppSDKSelfContained` to false
### Steps to reproduce the bug
Described above
### Expected behavior
WAP should place all the project into separate directory in output directory even `WindowsAppSDKSelfContained` is true
### Screenshots
_No response_
### NuGet package version
1.8.260317003
### Packaging type
Packaged (MSIX)
### Windows version
Windows 11 version 24H2 (26100, June 2025 Update)
### IDE
Visual Studio 2022
### Additional context
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the described WAP project setup with CsWinRTProject and WinRTCOMServer, comparing output directories when WindowsAppSDKSelfContained is true and false. Inspect the packaging and project-output logic involved, then verify that the projects remain isolated and that the CsWinRT component still runs with backgroundtaskhost.exe without file overwrites.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system, desktop-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100