Read and edit an .ini file with MSBuild

msbuild, vb6

Solution

I always use the FileUpdate-task from the MSBuildCommunityTasks, found on http://msbuildtasks.tigris.org/

You can use regular expressions to find the pattern and then replace in the text you want. For example: to replace the versionnumber in an assembly-info.cs:

<FileUpdate Files="@(VersioningAssemblyInfoFiles)"
                  Regex="AssemblyFileVersion\(&quot;.*&quot;\)\]"
                  ReplacementText="AssemblyFileVersion(&quot;$(VersionMajor).$(VersionMinor).$(VersionBuild).$(VersionRevision)&quot;)]" />

Problem

I am looking for an MSBuild task/script that will allow me to control the version of an old VB6 project? The .vbp stores the version information as .ini style, but I cannot find a simple way to read and write the three entries.

Original source