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
  • 2,221
  • 3
  • 29
  • 40

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,806
  • 2
  • 23
  • 25
0
<postBuild>
    <Exec command="cmd command to find and replace on file:$(OutputPath)\Main.qml"/>
</PostBuild>
baruchiro
  • 5,088
  • 5
  • 44
  • 66