microsoft / microsoft/WindowsAppSDK
VCLibs dependency incorrectly injected for Hybrid CRT self-contained apps via Microsoft.DesktopBridge.targets
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 4.7k
- Forks
- 471
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 28
Description
## Summary
When using the recommended "Hybrid CRT" approach for a self-contained Windows App SDK C++ desktop application, `Microsoft.DesktopBridge.targets` incorrectly injects VCLibs framework dependencies into the AppxManifest.xml during packaging, despite:
- Following the official self-contained deployment guide
- Setting `WinUISDKReferences=false` and `WindowsAppSDKSelfContained=true`
- Not actually requiring VCLibs at runtime (Hybrid CRT statically links the CRT)
This phantom dependency causes CI validation failures when submitting to package repositories like winget-pkgs, blocking deployment despite the application being truly self-contained.
## Impact
**Real-world blocker**: The FireDaemon Lozenge package PR was rejected by winget-pkgs automated validation due to this issue:
https://github.com/microsoft/winget-pkgs/pull/294680#issuecomment-3307942555
The application runs perfectly without VCLibs installed, but CI tools flag it as having missing dependencies, requiring manual intervention to unblock PRs.
## Environment
- **Windows App SDK**: 1.8.251003001
- **Windows SDK Build Tools**: 10.0.26100.6901
- **CppWinRT**: 2.0.250303.1
- **Setup**: Two-project solution (C++ .vcxproj + packaging .wapproj)
- **CRT approach**: Hybrid CRT (static linking, as recommended in [HybridCRT.md](https://github.com/microsoft/WindowsAppSDK/blob/main/docs/Coding-Guidelines/HybridCRT.md))
## The Problem
Despite correctly configuring the project for self-contained deployment, the final AppxManifest.xml contains:
```xml
```
Additionally, `Microsoft.VCLibs.x64.14.00.Desktop.appx` and `Microsoft.VCLibs.x64.14.00.appx` are copied to the bundle output folder.
**Root cause**: `Microsoft.DesktopBridge.targets` (specifically the `_ResolveVCLibDependencies` target) unconditionally determines there's a dependency on `Microsoft.VCLibs.Desktop, Version=14.0` and injects it during packaging, ignoring project configuration.
## Configuration Attempted
### .vcxproj settings:
```xml
false
false
Windows Store
true
None
true
false
false
```
### .wapproj settings:
```xml
true
false
false
```
### Package.appxmanifest (source):
```xml
```
**None of these settings prevent the VCLibs injection during the packaging phase.**
## Expected Behavior
When using Hybrid CRT with `WindowsAppSDKSelfContained=true` and `WinUISDKReferences=false`:
1. No VCLibs `PackageDependency` elements should appear in the final AppxManifest.xml
2. No VCLibs framework packages should be copied to the output folder
3. The packaged app should validate as truly self-contained
## Actual Behavior
`Microsoft.DesktopBridge.targets` ignores the project configuration and unconditionally:
1. Adds VCLibs PackageDependency entries to AppxManifest.xml
2. Copies VCLibs framework packages to the bundle output
3. Creates a dependency that doesn't exist at runtime
## Related Issues & Context
This appears to be a longstanding issue mentioned across multiple tickets:
**Hybrid CRT related:**
- #58 - Proposal: Address Project Reunion goals by addressing Visual Studio restrictions
- #1012 - Runtime install has missing dependency
- #2117 - Unable to release to the Microsoft Store (comment: https://github.com/microsoft/WindowsAppSDK/issues/2117#issuecomment-1043437985)
- #2143 - Proposal: remove requirement for CRT Redist if app is not using the CRT itself
- #2425 - Project templates should set `WinUISDKReferences=false`
- #4944 - Additional project properties when using the Hybrid CRT setup (comment: https://github.com/microsoft/WindowsAppSDK/issues/4944#issuecomment-3091967635)
**Most relevant:**
- #5799 - Enable tests in images that don't have the VCLibs available
- Comments: https://github.com/microsoft/WindowsAppSDK/issues/5799#issuecomment-3268458053
- https://github.com/microsoft/WindowsAppSDK/issues/5799#issuecomment-3278888777
- This issue directly mentions the same problem with `Microsoft.DesktopBridge.targets`
## Questions
1. Is there a supported way to prevent `Microsoft.DesktopBridge.targets` from injecting VCLibs dependencies for Hybrid CRT apps?
2. Should the presence of `WindowsAppSDKSelfContained=true` and `WinUISDKReferences=false` signal to the Desktop Bridge targets that VCLibs injection should be skipped?
3. Is there an MSBuild property or target override that can properly disable this behavior?
## Additional Context
The Hybrid CRT approach works flawlessly for deployment - the application runs perfectly without VCLibs installed. The issue is purely with the build/packaging tooling creating metadata that contradicts the actual runtime requirements, which breaks automated validation in distribution pipelines.
cc: @Scottj1s @alexlamtest (tagged based on #5799)
---
## Workaround Request
If there's no immediate fix possible, guidance on a supported workaround would be appreciated. Manual manifest editing post-build is fragile and doesn't survive rebuilds.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Microsoft.DesktopBridge.targets, especially the _ResolveVCLibDependencies target, and compare its behavior with the .vcxproj and .wapproj settings described in the issue. Verify the generated AppxManifest.xml and bundle output; done means Hybrid CRT self-contained packaging produces no VCLibs dependencies or copied VCLibs framework packages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- build-system, desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100