Skip to content

Fix syntax error in generated GitVersionInformation class when using project namespace#4197

Merged
arturcic merged 2 commits into
GitTools:mainfrom
rose-a:fix-4196
Sep 3, 2024
Merged

Fix syntax error in generated GitVersionInformation class when using project namespace#4197
arturcic merged 2 commits into
GitTools:mainfrom
rose-a:fix-4196

Conversation

@rose-a

@rose-a rose-a commented Sep 3, 2024

Copy link
Copy Markdown
Contributor

Fixes #4196.

Description

  • Added a regression test for generating the GitVersionInformation class using a target namespace
  • Remove trailing semicolon after namespace declaration

Using a file-scoped namespace declaration is not possible because of the optional declaration of ExcludeFromCodeCoverageAttribute in the same source file, which needs to be declared in the System.Diagnostics.CodeAnalysis namespace.

Related Issue

#4196

Motivation and Context

The target namespace declaration is now generated properly

How Has This Been Tested?

Regression test was added to GitVersion.Output.Tests (GitVersionInfoGeneratorTests.ShouldProperlyOutputNamespaceDeclaration())

Screenshots (if appropriate):

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@arturcic arturcic enabled auto-merge September 3, 2024 07:42
@arturcic arturcic merged commit 48cf530 into GitTools:main Sep 3, 2024
@mergify

mergify Bot commented Sep 3, 2024

Copy link
Copy Markdown
Contributor

Thank you @rose-a for your contribution!

@rose-a rose-a deleted the fix-4196 branch September 3, 2024 09:14
@jkkrause

jkkrause commented Sep 5, 2024

Copy link
Copy Markdown

@arturcic would this PR merge be sufficient motivation to publish a 6.0.3 to enable the MSBuild from working again with the explicit notice that UseProjectNamespaceForGitVersionInformation is required to make it work?

From the other threads on this issue (#4196 and #4116) the indication and general consensus seemed to be that getting MSBuild to work again would be a TBA/TBD scenario, but if I understand this commit/enhancement correctly, this PR would allow 'us' to use GitVersion 6.x with MSBuild scenarios again as long as the right set of properties are configured.

If I misunderstood, then apologies.

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.

[ISSUE]: Syntax error in generated GitVersionInformation class when using project namespace

3 participants