Skip to content

Conversation

@gep13
Copy link
Member

@gep13 gep13 commented Oct 30, 2025

Description Of Changes

This commit addresses this issue by creating a new method named
GenerateSolutionVersionFile, which is called now from two places. The
first, where the code was previously, and the second is the if
statements which gates the running of GitVersion. Now, the "fake"
asserted version numbers are passed into this new method, which then
ensures that the SolutionVersion.cs is created, and the build continues.

Motivation and Context

There is a code path which can be executed where GitVersion is not
executed, i.e. when using:

./build.bat --ShouldRunGitVersion=false

When doing this, the code generates a "fake" set of version numbers,
however, those version numbers never made their way into a generated
SolutionVersion.cs file (which is "needed" to have a successful build.

Testing

Use the instructions on the internal wiki to run with the latest version of the Chocolatey.Cake.Recipe package, but replace the usage of the gitversion.cake file with the one from this PR.

  1. Run ./build.bat --ShouldRunGitVersion=false
  2. Note that the build succeeds, where it would have failed before.

Operating Systems Testing

  • Windows 11

Change Types Made

  • Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added.
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v3 compatibility checked?

Related Issue

Fixes #211

@gep13 gep13 requested a review from corbob October 30, 2025 10:03
@gep13 gep13 changed the title (#211) (#211) Ensure SolutionVersion.cs file is created Oct 30, 2025
gep13 added 2 commits October 30, 2025 12:04
There is a code path which can be executed where GitVersion is not
executed, i.e. when using:

./build.bat --ShouldRunGitVersion=false

When doing this, the code generates a "fake" set of version numbers,
however, those version numbers never made their way into a generated
SolutionVersion.cs file (which is "needed" to have a successful build.

This commit addresses this issue by creating a new method named
GenerateSolutionVersionFile, which is called now from two places.  The
first, where the code was previously, and the second is the if
statements which gates the running of GitVersion.  Now, the "fake"
asserted version numbers are passed into this new method, which then
ensures that the SolutionVersion.cs is created, and the build continues.
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.

When GitVersion is not run, the SolutionVersion.cs file is not generated

1 participant