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

Preffered Version Scheme #59

Closed
wahmedswl opened this issue Nov 17, 2017 · 8 comments
Closed

Preffered Version Scheme #59

wahmedswl opened this issue Nov 17, 2017 · 8 comments

Comments

@wahmedswl
Copy link
Contributor

Hi,
It would be great if there would be single Property to access preferred version scheme. Following was copied from your article

private const string VERSION = ThisAssembly.Git.SemVer.Major + "." + ThisAssembly.Git.SemVer.Minor + "." + ThisAssembly.Git.Commits + "-" + ThisAssembly.Git.Branch + "+" + ThisAssembly.Git.Commit;

So, it would be great if this combine information is available in single property.

Thanks

@DragonQ
Copy link

DragonQ commented Nov 17, 2017

Surely the issue with this is not everyone uses the same versioning method. Unless you mean a user-customisable string rather than a built-in one?

@wahmedswl
Copy link
Contributor Author

yeah, but there is always a pattern which is commonly used in community and that pattern would be added as Property for direct usage. One can always construct version using the given information anyway.

@wahmedswl
Copy link
Contributor Author

@DragonQ GitInfo.txt can optionally have version scheme for Preferred version scheme also but that would complicate things

@kzu
Copy link
Member

kzu commented Nov 17, 2017 via email

@wahmedswl
Copy link
Contributor Author

wahmedswl commented Nov 17, 2017

@kzu thats fair, but would it be possible to add this format which gives all necessary info as single Property for easy consumption?

Got that scheme from http://www.cazzulino.com/git-info-from-msbuild-and-code.html just before Installation section

@kzu
Copy link
Member

kzu commented Nov 19, 2017 via email

@wahmedswl
Copy link
Contributor Author

@kzu thanks. We have adapted gitinfo as standard version manager across all projects and being gitinfo on NUGET and all the enhancements done in single place benefits everyone.

If not willing to make this change, its OK as everyone should agree and yeah, i can just copy paste this in every project i use simply not a big deal.

@kzu
Copy link
Member

kzu commented Nov 23, 2017

You wouldn't need to copy paste. You can create it in a single place, as a partial class of ThisAssembly, and include it in every project via a simple Directory.Build.targets file. Like so:

Version.cs:

partial class ThisAssembly
{
   public const string Version = ThisAssembly.Git.SemVer.Major + "." + ThisAssembly.Git.SemVer.Minor + "." + ThisAssembly.Git.Commits + "-" + ThisAssembly.Git.Branch + "+" + ThisAssembly.Git.Commit;
}

Directory.Build.targets:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <Compile Include="Version.cs" />
  </ItemGroup>
</Project>

Just place both files in an parent/ancestor folder of all your projects and it will just work.

@kzu kzu closed this as completed Nov 23, 2017
@devlooped devlooped locked and limited conversation to collaborators Sep 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants