Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

- added missing file

  • Loading branch information...
commit 0096a5868b1244b6c9a3e6862db9affc64780376 1 parent 15c7ba4
Sergey Bogdanov authored September 19, 2012

Showing 1 changed file with 34 additions and 0 deletions. Show diff stats Hide diff stats

  1. 34  build/Build.tasks
34  build/Build.tasks
... ...
@@ -0,0 +1,34 @@
  1
+<?xml version="1.0" encoding="utf-8"?>
  2
+<Project ToolsVersion="4.0" DefaultTargets="Go" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  3
+    <UsingTask TaskName="RegexTransform" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
  4
+        <ParameterGroup>
  5
+          <Items ParameterType="Microsoft.Build.Framework.ITaskItem[]" />
  6
+        </ParameterGroup>
  7
+        <Task>
  8
+          <Using Namespace="System.IO" />
  9
+          <Using Namespace="System.Text.RegularExpressions" />
  10
+          <Using Namespace="Microsoft.Build.Framework" />
  11
+          <Code Type="Fragment" Language="cs">
  12
+          <![CDATA[
  13
+            foreach(ITaskItem item in Items) {
  14
+              string fileName = item.GetMetadata("FullPath");
  15
+              string find = item.GetMetadata("Find");
  16
+              string replaceWith = item.GetMetadata("ReplaceWith");
  17
+              
  18
+              if(!File.Exists(fileName)) {
  19
+                Log.LogError(null, null, null, null, 0, 0, 0, 0, String.Format("Could not find version file: {0}", fileName), new object[0]);
  20
+              }
  21
+              string content = File.ReadAllText(fileName);
  22
+              File.WriteAllText(
  23
+                fileName,
  24
+                Regex.Replace(
  25
+                  content,
  26
+                  find,
  27
+                  replaceWith
  28
+                )
  29
+              );
  30
+            }
  31
+          ]]></Code>
  32
+        </Task>
  33
+      </UsingTask>
  34
+</Project>

0 notes on commit 0096a58

Please sign in to comment.
Something went wrong with that request. Please try again.