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 inAssemblyInfo.cs(is that true?), but also: - the command
dotnet-gitversion /updateassemblyinfohardcodedly updates the fileAssemblyInfo.cs(is that true?).
So, there are two possibilities:
- Either I only check in a part of
AssemblyInfo.csinto GIT (is this even possible?) - Either I find a way to put one of the
[assembly]items in another file thanAssemblyInfo.cs(is this even possible?)
Does anybody have an idea? Thanks
Try splitting the
[assembly]attributes between several files:FixedAssemblyInfo.cs, commit itdotnet-gitversion /updateassemblyinfocommand update the normalAssemblyInfo.cswhich will only contain dynamic values in this case. Don't commit this fileThe main idea is that the same
[assembly]attributes are not duplicated in both places.