Pass the build's versions to the examples MSBuild call - #352
Merged
Conversation
Four example solutions include the src/Spring projects directly - Northwind and the Quartz example are built by CompileExamples, SpringAir and WebQuickStart are skipped - so MSBuild's Rebuild recompiles Spring.Core and friends straight back into build/$(Configuration)/. That call passed no version properties, so the rebuild stamped the SDK default 1.0.0.0 over what CompileSolution had produced. While every assembly was 1.0.0.0 this was invisible. Now that CompileSolution sets real versions it is a hard failure: the clobbered Spring.Core is 1.0.0.0 while the copies already distributed into the other projects' output folders are 3.1.0.0, and the next example to reference two Spring assemblies dies with error CS1705: Assembly 'Spring.Messaging' ... uses 'Spring.Core, Version=3.1.0.0' which has a higher version than referenced assembly 'Spring.Core' with identity 'Spring.Core, Version=1.0.0.0' Apply the same versions to the MSBuild invocation. MSBuildSettings has no VersionPrefix/VersionSuffix setter, so those two go through SetProperty. Reproduced and verified locally with dotnet build on the Quartz example solution, which takes the same path: building it without version arguments takes build/Release/Spring.Core/net462/Spring.Core.dll from 3.1.0.0 to 1.0.0.0, and building it with them leaves it at 3.1.0.0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Marko Lahma <marko.lahma@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the
build-windowsregression from #351.CompileExamplescurrently fails with:Cause
Four example solutions include the
src/Springprojects directly rather than referencing built output:So
MSBuild /target:Restore;Rebuildon those recompilesSpring.Coreand friends straight back intobuild/$(Configuration)/. That call passed no version properties, so the rebuild stamped the SDK default1.0.0.0over whatCompileSolutionhad produced.While every assembly was
1.0.0.0this was invisible — the versions were uniformly wrong, so nothing conflicted. Now thatCompileSolutionsets real versions it is a hard failure:build/Release/Spring.Core/net462/Spring.Core.dllgets clobbered to1.0.0.0, while the copies already distributed into the other projects' output folders duringCompileSolutionare still3.1.0.0. The CI log shows exactly this — Northwind builds first and clobbers, then MsmqQuickStart hits the conflict:Fix
Apply the same versions to the examples
MSBuildinvocation, so every path that writes intobuild/agrees.MSBuildSettingshas noVersionPrefix/VersionSuffixsetter, so those two go throughSetProperty.Verification
CompileExamplescannot run on this machine (VS 2022's MSBuild 17.14 cannot load SDK 10.0.302 projects — CI uses VS 18), so the mechanism was reproduced directly withdotnet buildon the Quartz example solution, which takes the same path:The emitted command line now carries them:
build-windowson this PR is the real check, since it is the only placeCompileExamplesactually runs.