Skip to content
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

Unique namespace generation for GitVersionInformation class #3619

Merged

Conversation

Applesauce314
Copy link
Contributor

@Applesauce314 Applesauce314 commented Jul 5, 2023

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
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
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
Copy link
Member

@asbjornu asbjornu left a comment

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?

docs/input/docs/usage/msbuild.md Outdated Show resolved Hide resolved
docs/input/docs/usage/msbuild.md Outdated Show resolved Hide resolved
@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
104 of 105 checks passed
@mergify
Copy link
Contributor

mergify bot commented Jul 23, 2023

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