Recognizes version variables and updates the version accordingly - #478
Recognizes version variables and updates the version accordingly#478IT-VBFK wants to merge 2 commits into
Conversation
2e73450 to
1391641
Compare
f157a46 to
40c5ed9
Compare
There was a problem hiding this comment.
Pull request overview
Updates Fallout.Migrate’s .csproj rewrite logic to handle projects that pin Fallout/Nuke package versions via MSBuild properties (e.g., Version="$(NukeVersion)"), aligning with issue #477’s migration expectations.
Changes:
- Refines the “inline literal version” rewrite to avoid consuming
Version="$(...)"so variable-based versions can be handled separately. - Adds a new pass that discovers version variables used by PackageReferences and bumps the corresponding property values to the target Fallout version.
- Extends specs to cover
NukeVersion→FalloutVersionrenaming and arbitrary version-variable bumping behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/Fallout.Migrate/CsprojRewriter.cs |
Adds variable-aware version handling and bumps property-based versions to the target Fallout version. |
tests/Fallout.Migrate.Specs/CsprojRewriterSpecs.cs |
Adds/adjusts specs to validate migration behavior for version variables. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
da9ece9 to
d3fc9b9
Compare
d3fc9b9 to
f3ff5e1
Compare
|
@copilot review |
f3ff5e1 to
2fb66d4
Compare
2fb66d4 to
51c3c6b
Compare
0550dd3 to
8e438a1
Compare
|
Do not merge, please (meaning now). I rebase the commits later to better commits :) |
fb768bd to
32902ef
Compare
|
Cool I couldn't imagine how far your migration refactoring could go 😂😂 |
02e6f48 to
75c7270
Compare
f29e707 to
cb4fb9d
Compare
dennisdoomen
left a comment
There was a problem hiding this comment.
Nice improvement with a little bit of rework
dennisdoomen
left a comment
There was a problem hiding this comment.
Grouped review: three related findings on the new property-variable bump logic.
c779f2c to
39b1b12
Compare
|
Ok.. as I can see this is more or less the version like before, except the verify conversion |
a3f2075 to
8da8ebc
Compare
|
Can we move forward on that one? And: can this go into 10.4? |
You've marked some of my (and my AI friend's) comments as resolved, but didn't answer nor fix anything. I've reopened those. |
8da8ebc to
e93de33
Compare
Sorry that this went like that.. Added a new test case for the non-PropertyGroup case, and added whitespaces to the version property tags. |
e93de33 to
5b26331
Compare
5b26331 to
943586a
Compare
|
im a bit lost with this one @IT-VBFK is this ready for review now? if we wanna get this in into 10.4 I'd say lets try to get this merged in the next few days :-) |
|
Yes |
Summary
Update
Fallout.Migrateso that package versions referenced through MSBuild properties are migrated to the target Fallout version.Previously, the
.csprojrewriter handled package references with literal versions:However, projects that shared a version through an MSBuild property were only partially migrated:
The package IDs could be renamed to
Fallout.*, while the property and its value remained on the old NUKE version.This left the migrated project in an inconsistent state and could cause package restore or build failures.
Closes #477.
What changed
Distinguish literal versions from property-based versions
The inline package-version rewrite now excludes version values beginning with an MSBuild property expression such as:
This prevents the existing literal-version rewrite from replacing the property reference itself with an inline version.
Property-based version management therefore remains property-based after migration.
For example:
is processed by the property-aware migration flow instead of being flattened into:
Detect version properties used by package references
A new rewrite pass discovers MSBuild properties referenced by
PackageReferenceversion attributes:The referenced property names are deduplicated and used to locate the corresponding property elements in the project file.
Update referenced property values
For each discovered version property, the rewriter updates its value to the requested Fallout version.
A NUKE-specific version property is migrated completely.
Before:
After:
The existing MSBuild-property migration renames
NukeVersiontoFalloutVersion, while the new rewrite updates the property's value.Preserve custom property names
Projects are not required to name their shared version property
NukeVersion.When a custom property is used, its name is preserved and only its value is updated.
Before:
After:
This keeps the project's existing version-management structure intact while ensuring that migrated Fallout packages use the correct version.
Leave unrelated properties untouched
Only properties referenced by a
PackageReferenceversion attribute are selected for updating.Other version-like properties in the same project are left unchanged, avoiding broad replacements based solely on property names or values.
Migration behavior
$(NukeVersion)FalloutVersion, and the property value is updatedTests
Added regression coverage for the scenarios reported in #477:
NukeVersionproperty is renamed toFalloutVersion.$(NukeVersion)are updated to use$(FalloutVersion).Result
Running
fallout-migratenow produces a consistent.csprojfor projects that manage NUKE package versions through MSBuild properties.Both the package references and the property supplying their version are migrated automatically, without requiring users to manually repair the project afterward.
🤖 helped out here :D