Im trying to replace the ProductName held inside a Visual Studio setup project by performing a regex on the file in my msbuild script. To do the regEx replacement Im trying to use msbuild extension pack and in particular its File task. The target inside my msbuild script looks like this:
<Target Name="CustomiseMsi">
<PropertyGroup>
<RegExPattern>
<![CDATA[(?:\""ProductName\"" = \""8:.*)]]>
</RegExPattern>
<RegExReplacement>
<![CDATA["\"ProductName\" = \"8:MyApp v1.0\""]]>
</RegExReplacement>
<RegExOutput></RegExOutput>
</PropertyGroup>
<MSBuild.ExtensionPack.FileSystem.File
TaskAction="Replace"
RegexPattern="$(RegExPattern)"
Replacement="$(RegExReplacement)"
Files="@(AbsolutePathToVdProjToParse)">
</MSBuild.ExtensionPack.FileSystem.File></Target>
When this target runs I get the following output, but the file remains unchanged.
CustomiseMsi:
Processing File Collection
Processing File: C:\pathHere\mySetup.vdproj
Am I going about this right way? Has anyone done regex updated on a vdproj (or anything else) in this manner?