forked from reactjs/React.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReact.tasks.proj
More file actions
63 lines (59 loc) · 2.17 KB
/
React.tasks.proj
File metadata and controls
63 lines (59 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright (c) 2015, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildProjectDirectory)\tools\MSBuildTasks\MSBuild.Community.Tasks.Targets" />
<UsingTask
AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll"
TaskName="TransformXml"
/>
<UsingTask
TaskName="SetEnvironmentVariable"
TaskFactory="CodeTaskFactory"
AssemblyFile="C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<Name Required="true" />
<Value Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Code Type="Fragment" Language="cs"><![CDATA[
Log.LogError(Name + " = " + Value);
Environment.SetEnvironmentVariable(Name, Value);
]]></Code>
</Task>
</UsingTask>
<UsingTask
TaskName="UpdateAspNetProjectVersion"
TaskFactory="CodeTaskFactory"
AssemblyFile="C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<Files ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
<Version Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Using Namespace="System.Text.RegularExpressions" />
<Code Type="Fragment" Language="cs"><![CDATA[
// This should be using a real JSON parser rather than regular expressions, but it will
// do for now.
var versionRegex = new Regex("\"version\": \"([^\"]+)\"");
foreach (var file in Files) {
var path = file.GetMetadata("FullPath");
var contents = File.ReadAllText(path);
var newContents = versionRegex.Replace(
contents,
string.Format("\"version\": \"{0}\"", Version)
);
File.WriteAllText(path, newContents);
Log.LogMessage("Updated version in {0}", path);
}
]]></Code>
</Task>
</UsingTask>
</Project>