diff options
author | nicolas.dorier <nicolas.dorier@gmail.com> | 2019-06-21 16:22:55 +0900 |
---|---|---|
committer | nicolas.dorier <nicolas.dorier@gmail.com> | 2019-06-21 16:23:35 +0900 |
commit | e47e79377f5d81b567881fcba851772bda0cefd8 (patch) | |
tree | 4151e719aee5348f3591f05a460510f7a5136140 /build_msvc/msbuild/tasks/replaceinfile.targets | |
parent | 23815ee74dfd08c746a70eeee4eeb1ad3af052f1 (diff) |
[MSVC]: Create the config.ini as part of bitcoind build
Diffstat (limited to 'build_msvc/msbuild/tasks/replaceinfile.targets')
-rw-r--r-- | build_msvc/msbuild/tasks/replaceinfile.targets | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/build_msvc/msbuild/tasks/replaceinfile.targets b/build_msvc/msbuild/tasks/replaceinfile.targets new file mode 100644 index 0000000000..2ccb8b30e0 --- /dev/null +++ b/build_msvc/msbuild/tasks/replaceinfile.targets @@ -0,0 +1,35 @@ +<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>
\ No newline at end of file |