Skip to content

Add assets to .csproj during win app init#461

Merged
nmetulev merged 7 commits into
mainfrom
zt/444-init-should-add-assets-as-content
Apr 21, 2026
Merged

Add assets to .csproj during win app init#461
nmetulev merged 7 commits into
mainfrom
zt/444-init-should-add-assets-as-content

Conversation

@zateutsch
Copy link
Copy Markdown
Contributor

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.

Copilot AI review requested due to automatic review settings April 18, 2026 21:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .csproj mutation logic in DotNetService to insert an ItemGroup with an Assets glob when missing.
  • Add unit tests covering the new .csproj update behavior (and route the call through FakeDotNetService).

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.

Comment thread src/winapp-CLI/WinApp.Cli/Services/DotNetService.cs Outdated
Comment thread src/winapp-CLI/WinApp.Cli/Services/IDotNetService.cs Outdated
Comment thread src/winapp-CLI/WinApp.Cli.Tests/DotNetServiceTests.cs
Comment thread src/winapp-CLI/WinApp.Cli.Tests/DotNetServiceTests.cs
zateutsch and others added 2 commits April 18, 2026 17:12
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@zateutsch
Copy link
Copy Markdown
Contributor Author

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 18, 2026

@copilot apply changes based on the comments in this thread

Applied the review-thread updates in commit e9a9afb: updated the remaining DotNetService tests to expect/use the correct MSBuild glob (Assets\**\*) so they align with the implementation and comments.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 18, 2026

Build Metrics Report

Binary Sizes

Artifact Baseline Current Delta
CLI (ARM64) 30.65 MB 30.65 MB 📈 +6.0 KB (+0.02%)
CLI (x64) 31.01 MB 31.02 MB 📈 +6.0 KB (+0.02%)
MSIX (ARM64) 12.93 MB 12.93 MB 📈 +7.9 KB (+0.06%)
MSIX (x64) 13.73 MB 13.74 MB 📈 +2.2 KB (+0.02%)
NPM Package 26.89 MB 26.89 MB 📈 +1.1 KB (+0.00%)
NuGet Package 26.97 MB 26.98 MB 📈 +2.5 KB (+0.01%)
VS Code Extension 19.71 MB 19.71 MB 📈 +2.0 KB (+0.01%)

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 Time

44ms median (x64, winapp --version) · ✅ +6ms vs. baseline


Updated 2026-04-21 05:00:50 UTC · commit f274dc4 · workflow run

return true;
}

[GeneratedRegex(@"<Content\s[^>]*Include\s*=\s*""Assets\\", RegexOptions.IgnoreCase)]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't possible for there to be assets used by the application that aren't in the manifest?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@nmetulev nmetulev merged commit 76dffe2 into main Apr 21, 2026
19 checks passed
@nmetulev nmetulev deleted the zt/444-init-should-add-assets-as-content branch April 21, 2026 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

winapp init should add asset files as Content items in the csproj

4 participants