I am very new to cakebuild. I want to update the version info of assemblyinfo.cs using cakebuild.
public static void CreateAssemblyInfo()
method overwrites the entire content of the assemblyinfo file. But I need just version info to be updated.
How can I achieve this.?
Regards, Aradhya
If you do not want to have separate files you can also use a regex replace:
Depending on your AssemblyInfo file you may want to also replace the values of
AssemblyFileVersion
orAssemblyInformationalVersion
Have 2 files, one for static stuff and one for the auto generated bits.
The pattern I usually apply is to have an
SolutionInfo.cs
that's shared between projects and aAssemblyInfo.cs
per project which are unique per project.An example folder structure could be
And basically your csproj file would instead of:
Be something like:
This way you keep any manual edits to your
AssemblyInfo.cs
and can safely auto generate without risk of overwriting that info.This also lets you share things like version / copyright / company between projects in a solution.
The Cake build script part of this would look something like this: