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

Add version info to output assembly #22

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

BinToss
Copy link
Member

@BinToss BinToss commented Dec 18, 2021

Resolves #20

Authorized contributors can contribute to this PR by checking out and pushing to feat/gitVersion.


Version.rc resource file

On Windows, the File Version and Product Version properties (as well as others) in a File Properties tab are described by a C++ project's 'Version' resource.
A Version resource can be added to and modified in an existing assembly (EXE/DLL) or written to a project's Version.rc.
To write GitVersion variables to Version.rc before/during Link-time, we'll need to assign the variables to compile-time constants.
The File (GitVersion_FullSemVer) and Product (GitVersion_InformationalVersion) version variables (unless otherwise stated) must be assigned in two ways: string data and int-array data (1,0,5,0 (oh god why)).
I do not know how the informational version value (string) could be assigned to the Product Version int array, so I hope we don't actually need the int arrays.

I'd prefer having GitVersion's variables available before and during Link-time so the version information can be tested locally.


Placeholder .NET project

After some investigation, this is not possible.
Version.rc/.h is the only way to add File Version and Product Version data in an unmanaged project.

This requires less effort on my end, but may be unusual compared to other C++ projects' methods of versioning.

1. Apply version information to a dotnet project targeting .NET 4.8, build that project before the C++ project
2. Use a certain C++ Linker feature to grab the .NET assembly's version info which the Linker then uses to overwrite the C++ assembly's version info.


Documentation and References

@github-actions
Copy link

Pull Request Validation Report

This comment is automatically generated by Conventional PR

Whitelist Report

  • ✅ Pull request is still a draft and should be ignored
  • ❌ Pull request is submitted by a bot and should be ignored
  • ❌ Pull request is submitted by user with high privileges and should be ignored

Result

Pull request matches with one (or more) enabled whitelist criteria. Pull request validation is skipped.

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.

Add version info to output assembly
1 participant