Add assets to .csproj during win app init#461
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the winapp init flow to ensure visual assets generated under the Assets/ directory are included in .NET project .csproj files as Content items, so MSIX tooling picks them up for packaging (fixes #444).
Changes:
- Invoke a new
IDotNetService.EnsureAssetContentItemsAsync()step during workspace setup for .NET projects. - Implement
.csprojmutation logic inDotNetServiceto insert anItemGroupwith anAssetsglob when missing. - Add unit tests covering the new
.csprojupdate behavior (and route the call throughFakeDotNetService).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/winapp-CLI/WinApp.Cli/Services/WorkspaceSetupService.cs | Calls into EnsureAssetContentItemsAsync() during init to add asset Content items. |
| src/winapp-CLI/WinApp.Cli/Services/IDotNetService.cs | Adds a new service API for ensuring asset content items exist in the .csproj. |
| src/winapp-CLI/WinApp.Cli/Services/DotNetService.cs | Implements .csproj scanning + insertion of an Assets glob Content entry. |
| src/winapp-CLI/WinApp.Cli.Tests/FakeDotNetService.cs | Exposes the new method via the test fake (delegating to the real implementation). |
| src/winapp-CLI/WinApp.Cli.Tests/DotNetServiceTests.cs | Adds tests for adding/skipping the asset Content include. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/microsoft/winappCli/sessions/eed10977-2311-4c9c-bf4c-b57e6068271e Co-authored-by: zateutsch <88554871+zateutsch@users.noreply.github.com>
Applied the review-thread updates in commit |
Build Metrics ReportBinary Sizes
Test Results✅ 770 passed out of 770 tests in 428.0s (+4 tests, +25.4s vs. baseline) Test Coverage❌ 20.9% line coverage, 35.2% branch coverage · ✅ no change vs. baseline CLI Startup Time44ms median (x64, Updated 2026-04-21 05:00:50 UTC · commit |
| return true; | ||
| } | ||
|
|
||
| [GeneratedRegex(@"<Content\s[^>]*Include\s*=\s*""Assets\\", RegexOptions.IgnoreCase)] |
There was a problem hiding this comment.
This is asuming assets live in the Assets folder, but they can be anywhere - should look at the manifest to locate all referenced assets and ensure they are included
There was a problem hiding this comment.
Isn't possible for there to be assets used by the application that aren't in the manifest?
There was a problem hiding this comment.
The assets referenced in the appxmanifest can be any folder like images\logo.png, not necessarily in the Assets folder. But thinking about it, we are only adding this when we add the assets which will always be in the Assets folder, so it's probably a non issue
fixes #444
This pull request makes it so that all files in the Assets directory are added as content items to the csproj during
winapp init.Uses a glob pattern
Assets/**instead of individual references.