Skip to content

Unique namespace generation for GitVersionInformation class#3619

Merged
asbjornu merged 12 commits into
GitTools:mainfrom
Applesauce314:feature/uniqueNamespaceGeneration
Jul 23, 2023
Merged

Unique namespace generation for GitVersionInformation class#3619
asbjornu merged 12 commits into
GitTools:mainfrom
Applesauce314:feature/uniqueNamespaceGeneration

Conversation

@Applesauce314

@Applesauce314 Applesauce314 commented Jul 5, 2023

Copy link
Copy Markdown
Contributor

Description

adds a configuration option

<GenerateGitVersionInformationInUniqueNamespace>true</GenerateGitVersionInformationInUniqueNamespace>

to allow the creation of the GitVersionInformation class in a namespace related to the project it is in.
this allows different projects to have the class in different namespaces so if internalsvisibleto attribute is used there is not class name collision (CS0436), eliminating the need to suppress the issue.

Related Issue

issue #3606
Issue #448

Motivation and Context

Elimination of CS0436

How Has This Been Tested?

wrote unit tests to cover added code

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.

Comment on lines +26 to +32
{1}{2}
{4}[global::System.Runtime.CompilerServices.CompilerGenerated]
{4}[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
{4}static class GitVersionInformation
{4}{{
{0}
}}
{4}}}{3}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part here is the most clunky, I would much prefer a cleaner way of handling the indent/non-indent and brackets needed for the csharp namespace.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is not very elegant. Pull requests to improve it are welcome.

@Applesauce314 Applesauce314 marked this pull request as ready for review July 5, 2023 18:18

@asbjornu asbjornu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a nice addition that may resolve a few bugs reported over the years, but I think the proposed name is a bit too long, unwieldy, and imprecise. How do you feel about UseProjectNamespace?

Comment thread docs/input/docs/usage/msbuild.md Outdated
Comment thread docs/input/docs/usage/msbuild.md Outdated
@asbjornu asbjornu linked an issue Jul 23, 2023 that may be closed by this pull request
@asbjornu asbjornu merged commit fdae670 into GitTools:main Jul 23, 2023
@mergify

mergify Bot commented Jul 23, 2023

Copy link
Copy Markdown
Contributor

Thank you @Applesauce314 for your contribution!

@Applesauce314 Applesauce314 deleted the feature/uniqueNamespaceGeneration branch July 24, 2023 11:52
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.

[Bug] CS0436 may be present with InternalsVisibleTo

2 participants