如何使用cake只更新assemblyinfo.cs中的版本信息?

编程入门 行业动态 更新时间:2024-10-19 20:34:35
本文介绍了如何使用cake只更新assemblyinfo.cs中的版本信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我对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中的版本信息?

本文发布于:2023-11-07 05:43:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1565688.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   版本   信息   assemblyinfo   cake

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!