mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-19 18:09:47 +01:00
35 lines
1.0 KiB
XML
35 lines
1.0 KiB
XML
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
<UsingTask
|
|
TaskName="ReplaceInFile"
|
|
TaskFactory="CodeTaskFactory"
|
|
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" >
|
|
<ParameterGroup>
|
|
<FilePath Required="true" />
|
|
<Replace Required="true" />
|
|
<By Required="false" />
|
|
<ToFullPath Required="false" />
|
|
</ParameterGroup>
|
|
<Task>
|
|
<Using Namespace="System"/>
|
|
<Using Namespace="System.IO"/>
|
|
<Code Type="Fragment" Language="cs">
|
|
<![CDATA[
|
|
if(File.Exists(FilePath) == false) {
|
|
Log.LogError("replaceinfile task could not locate " + FilePath + ".");
|
|
}
|
|
else {
|
|
var data = File.ReadAllText(FilePath);
|
|
var by = By;
|
|
if (ToFullPath == "true")
|
|
{
|
|
by = Path.GetFullPath(by);
|
|
}
|
|
data = data.Replace(Replace, by);
|
|
Log.LogMessage("Replace '" + Replace + "' by '" + by + "' in " + FilePath);
|
|
File.WriteAllText(FilePath, data, new System.Text.UTF8Encoding(false));
|
|
}
|
|
]]>
|
|
</Code>
|
|
</Task>
|
|
</UsingTask>
|
|
</Project> |