Dynamically Pack MVVM SourceGen project outputs
Closes #219
Changes
Previously, static output path to the MVVM SourceGen assembly was used to pack the MVVM project. This leads to error when OutputPath was updated dynamically when testing a new feature (see #96).
So, here, we'll update the build so that the SourceGen build outputs will be dynamically packed. We first get the build outputs dynamically via GetBuildOutputs MSBuild target mirroring NuGet's Pack targets. Then, we add it to the package via _PackageFiles (an internal MSBuild item used by NuGet's Pack targets). This is brittle only if @NuGet team decides to modify/remove _PackageFiles which is highly unlikely.
PR Checklist
- [x] Created a
featurebranch in your fork - [x] Based off latest main branch of toolkit
- [x] PR doesn't include merge commits (always rebase on top of our main)
- [x] Header has been added to all new source files (ran build/Update-Headers.ps1)
- [x] Tested code with current supported SDKs
- [x] Contains NO breaking changes
- [x] Code follows all style conventions
Notes
Also, this is brittle only if @NuGet team decides to modify/remove _PackageFiles which is highly unlikely.
One interesting side-effect of this implementation is that when we decide to multi-target, we can easily modify our solution to be more resilient without having to tackle the problem again since we already output the artifacts by TFM. This should save hours of headbutting against the wall 😉!!
- Rebase merge please.
- Wait for my refactor PR to be merged!
- When merging, please update the commit title to PR title instead of the default
Merge pull request #xxxx from repo/branch, and commit message to either PR message or messages of individual commits. Theauto-mergeoption does this by default.
Please merge this only after merging #85 as it depends on some changes from that PR. All the 3 PRs are correlated since the changes cascade into the other.