问题描述
我对Cakebuild非常陌生。我想使用cakebuild更新assemblyinfo.cs的版本信息。
I am very new to cakebuild. I want to update the version info of assemblyinfo.cs using cakebuild.
public static void CreateAssemblyInfo()
方法覆盖assemblyinfo文件的全部内容。但是我只需要更新版本信息。
public static void CreateAssemblyInfo()
method overwrites the entire content of the assemblyinfo file. But I need just version info to be updated.
如何实现此目标??
问候,
Aradhya
Regards,Aradhya
推荐答案
如果您不想拥有单独的文件,也可以使用正则表达式替换:
If you do not want to have separate files you can also use a regex replace:
#addin "Cake.FileHelpers"
var yourVersion = "1.0.0.0";
Task("SetVersion")
.Does(() => {
ReplaceRegexInFiles("./your/AssemblyInfo.cs",
"(?<=AssemblyVersion\\(\")(.+?)(?=\"\\))",
yourVersion);
});
根据您的AssemblyInfo文件,您可能还希望替换 AssemblyFileVersion的值
或 AssemblyInformationalVersion
Depending on your AssemblyInfo file you may want to also replace the values of AssemblyFileVersion
or AssemblyInformationalVersion
这篇关于如何使用cake只更新assemblyinfo.cs中的版本信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!