Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 3, 2024

Conversation

rose-a
Copy link
Contributor

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

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
106 checks passed
Copy link
Contributor

mergify bot commented Sep 3, 2024

Thank you @rose-a for your contribution!

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

jkkrause commented Sep 5, 2024

@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