1

I have the following in my .csproj:

<ItemGroup>
  <Content Include="Main.qml" CopyToPublishDirectory="Always" />
</ItemGroup>

I need to find & replace some text in Main.qml on the copy in the published directory. Is this possible?

Vadim Peretokin
  • 1,756
  • 2
  • 26
  • 34

2 Answers2

1

The MSBuild Extension Pack has a File class that accepts a TaskAction of Replace. This action can perform a Regex replace.

You would use it something like this:

<MSBuild.ExtensionPack.FileSystem.File TaskAction="Replace" RegexPattern="input*" Replacement="repl" Path="C:\$(ProjectDir)\$(PublishDir)\Main.qml"/>
Rich Tebb
  • 6,311
  • 1
  • 21
  • 24
0
<postBuild>
    <Exec command="cmd command to find and replace on file:$(OutputPath)\Main.qml"/>
</PostBuild>
baruchiro
  • 3,803
  • 3
  • 34
  • 49