Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read and edit an .ini file with MSBuild

Tags:

msbuild

vb6

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.

like image 703
Rob Hunter Avatar asked Nov 18 '25 19:11

Rob Hunter


1 Answers

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;)]" />
like image 87
Bart Janson Avatar answered Nov 20 '25 23:11

Bart Janson