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

Use 'const string' in GitVersionInformation.cs #1376

Closed
mgnslndh opened this issue Feb 21, 2018 · 2 comments
Closed

Use 'const string' in GitVersionInformation.cs #1376

mgnslndh opened this issue Feb 21, 2018 · 2 comments
Labels

Comments

@mgnslndh
Copy link
Contributor

How about using a const string instead of a static string in the generated GitVersionInformation.cs? This would make it possible to use the values in attributes such as

[assembly: AssemblyConfiguration(GitVersionInformation.PreReleaseLabel)]

https://github.com/GitTools/GitVersion/blob/master/src/GitVersionCore/GitVersionInformationResources/AddFormats/GitVersionInformation.cs

@jbaehr
Copy link
Contributor

jbaehr commented Aug 14, 2018

I support this idea.

(The only point in favor of static readonly string would be that const string gets inlined at compile-time. But since the whole class is private you cannot reference this information from a foreign assembly anyway...)

It's a breaking change for those using reflection, though. Anyway, prior to a final release this is acceptable and I assume only a few people to be affected. And the benefits outweigh the drawbacks by far.

@stale
Copy link

stale bot commented Jun 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants