代码之家  ›  专栏  ›  技术社区  ›  Rob Hunter

使用MSBuild读取和编辑.ini文件

  •  3
  • Rob Hunter  · 技术社区  · 16 年前

    我正在寻找一个MSBuild任务/脚本,它将允许我控制旧VB6项目的版本?

    2 回复  |  直到 16 年前
        1
  •  5
  •   Bart Janson    16 年前

    我总是使用MSBuildCommunityTasks中的FileUpdate任务,该任务位于 http://msbuildtasks.tigris.org/

    您可以使用正则表达式查找模式,然后替换所需的文本。 例如:要替换程序集中的版本号info.cs:

    <FileUpdate Files="@(VersioningAssemblyInfoFiles)"
                      Regex="AssemblyFileVersion\(&quot;.*&quot;\)\]"
                      ReplacementText="AssemblyFileVersion(&quot;$(VersionMajor).$(VersionMinor).$(VersionBuild).$(VersionRevision)&quot;)]" />
    
        2
  •  2
  •   Preet Sangha    16 年前

    我不确定它是否在任何库中实现

    你可以实施一个 custom task 这叫 GetPrivateProfileString .

    然而,一个新颖的想法是 convert the file automatically to XML 通过MSBUILD exec调用,然后使用MSBUILD更容易地解析该xml。