PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label gitversion. Show all posts
Showing posts with label gitversion. Show all posts

Sunday, October 9, 2022

[FIXED] How to handle fixed and variable [assembly] items if both seem to be present mandatory inside one file?

 October 09, 2022     assemblyinfo, c#, continuous-integration, git, gitversion     No comments   

Issue

I'm setting up a Build Server, also known as a Continuous Integration Server, based on Jenkins, for building C# applications and DLLs.

I have an AssemblyInfo.cs file, which contains two kinds of information:

Fixed information, like:

[assembly: AssemblyTitle("Application title")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("MyCompany")]
...

... and variable information, like:

[assembly: AssemblyInformationalVersion("Sha.99560ad4873ab9e04bb8f262aafb5b3ee2fb6c1e")]

(This is generated by the command dotnet-gitversion /updateassemblyinfo)

The idea is that all those [assembly] entries come together in order to uniquely define every built binary (Application.exe, right-click and ask for "Details"), based on its commit hash.

As you can see, the first [assembly] entries are fixed, while the last one is variable.

So, I would like to have the first three ones in GIT, and the last one in .GitIgnore (or ignored by GIT in another way), but how to do that?

As far as I have understood

  • the mentioned [assembly] like [assembly: AssemblyTitle("Application title")] must be put in AssemblyInfo.cs (is that true?), but also:
  • the command dotnet-gitversion /updateassemblyinfo hardcodedly updates the file AssemblyInfo.cs (is that true?).

So, there are two possibilities:

  • Either I only check in a part of AssemblyInfo.cs into GIT (is this even possible?)
  • Either I find a way to put one of the [assembly] items in another file than AssemblyInfo.cs (is this even possible?)

Does anybody have an idea? Thanks


Solution

Try splitting the [assembly] attributes between several files:

  • for example, keep all fixed values in FixedAssemblyInfo.cs, commit it
  • let the dotnet-gitversion /updateassemblyinfo command update the normal AssemblyInfo.cs which will only contain dynamic values in this case. Don't commit this file

The main idea is that the same [assembly] attributes are not duplicated in both places.



Answered By - Yan Sklyarenko
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Sunday, August 21, 2022

[FIXED] What does the environment variable IGNORE_NORMALISATION_GIT_HEAD_MOVE do?

 August 21, 2022     c#, environment-variables, git, git-detached-head, gitversion     No comments   

Issue

I have a C# code base that uses GitVersion.MsBuild. Sometimes my Jenkins build server gives me this error:

GitVersion.BugException: GitVersion has a bug, your HEAD has moved after repo normalisation.
To disable this error set an environmental variable called IGNORE_NORMALISATION_GIT_HEAD_MOVE to 1

This often happens when building a feature branch that is not based on the latest master (i.e., master has moved since the feature branch was made).

The error message describes a suggested fix/workaround, but I am hesitant to do this because I don't know what environmental variable IGNORE_NORMALISATION_GIT_HEAD_MOVE does, and I cannot find a description of it anywhere.

If I set IGNORE_NORMALISATION_GIT_HEAD_MOVE to 1, what side effects does this have?

Thanks in advance!

EDIT: I asked the same question in an issue on GitVersion's GitHub.


Solution

According to the maintainers of GitVersion, this variable just suppresses a BugException that otherwise gets throw in this situation.

See issue here: https://github.com/GitTools/GitVersion/issues/2934



Answered By - Claus Appel
Answer Checked By - Timothy Miller (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home
View mobile version

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing