Skip to content

Add C++ (Modern/UWP,MFC, etc.) support for SemVer in GitVersion #1428

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

Closed
wants to merge 5 commits into from
Closed

Add C++ (Modern/UWP,MFC, etc.) support for SemVer in GitVersion #1428

wants to merge 5 commits into from

Conversation

stunney
Copy link

@stunney stunney commented Jun 27, 2018

A few simple steps to get this working

  1. Create a file called "GitVersionTaskAssemblyInfo.h" right beside your .vcxproj
  2. Fill it with this:
    #pragma once

#define VERSION_STR(x) #x
#define VERSION_XSTR(x) VERSION_STR(x)
#define VERSION_BLANK ""
#define VERSION_FULL 0,0,0,0
#define VERSION_STRING VERSION_XSTR(0.0.0.0) VERSION_BLANK "\0"

  1. Create a version resource (filename does not matter)
  2. Modify the .rc code:
    ++ Add "#include "GitVersionAssemblyInfo.g.h" somewhere near the top
    Modify the versioninfo lines to be (lines 53,54 in a typical, default Version resouce file):
    FILEVERSION VERSION_FULL
    PRODUCTVERSION VERSION_FULL

and

Modify the block for the PE description as follows for the FileVersion and ProductVersion lines

VALUE "FileVersion", VERSION_FULL
VALUE "ProductVersion", VERSION_STRING

  1. Add your GitVersion.yml to your heart's delight.

  2. Drink coffee (or beverage of choice).

stunney added 2 commits June 27, 2018 16:12
Two simple steps to get this working
1) Create a file called "GitVersionTaskAssemblyInfo.h" right beside your .vcxproj
2) Fill it with this:
#pragma once

#define VERSION_STR(x)			#x
#define VERSION_XSTR(x)			VERSION_STR(x)
#define VERSION_BLANK ""
#define VERSION_FULL 0,0,0,0
#define VERSION_STRING VERSION_XSTR(0.0.0.0) VERSION_BLANK "\0"

3) Create a version resource (filename does not matter)
4) Modify the code:
++ Add "#include "GitVersionAssemblyInfo.g.h" somewhere near the top
Modify the versioninfo lines to be (lines 53,54 in a typical, default Version resouce file):
FILEVERSION VERSION_FULL
PRODUCTVERSION VERSION_FULL

and

Modify the block for the PE description as follows for the FileVersion and ProductVersion lines

VALUE "FileVersion", VERSION_FULL
VALUE "ProductVersion", VERSION_STRING
Shouldn't leave this in there for pull request.
@@ -47,7 +47,9 @@
<HintPath>..\packages\LibGit2Sharp.0.23.0-pre20160922233542\lib\net40\LibGit2Sharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll</HintPath>

Choose a reason for hiding this comment

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

I think you don't need to reference assembly by explicit path.

Copy link
Author

Choose a reason for hiding this comment

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

Bah! I blame visual studio for this abomination! Thanks. I will just revert this to the original line.

stunney added 3 commits June 29, 2018 10:33
Going back to the original value of this Reference node.
Not sure why this is failing in appveyor.  Adding standard whitespace before Node termination.
@stunney
Copy link
Author

stunney commented Jun 29, 2018

Bah! Time to re-base and resubmit... Apologies guys!

@stunney stunney closed this Jun 29, 2018
@stunney
Copy link
Author

stunney commented Jun 29, 2018

@denis-ivanov I have submitted a new PR. Can you please review?

I did not realize that your VS projects were on steroids and I didn't actually need to modify them. I'm not used to that from VS projects. This pleases me.

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.

2 participants