This repository was archived by the owner on Oct 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 807
Expand file tree
/
Copy pathSample.proj
More file actions
153 lines (127 loc) · 4.3 KB
/
Copy pathSample.proj
File metadata and controls
153 lines (127 loc) · 4.3 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="All" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Required Import to use MSBuild Community Tasks -->
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<!-- These are sample targets the demonstrate the use of MSBuild Community Tasks -->
<Target Name="AssemblyInfo">
<AssemblyInfo CodeLanguage="CS"
OutputFile="AssemblyInfo.cs"
AssemblyTitle="AssemblyInfoTask"
AssemblyDescription="AssemblyInfo Description"
AssemblyConfiguration=""
AssemblyCompany="Company Name, LLC"
AssemblyProduct="AssemblyInfoTask"
AssemblyCopyright="Copyright (c) Company Name, LLC 2005"
AssemblyTrademark=""
ComVisible="false"
CLSCompliant="true"
Guid="d038566a-1937-478a-b5c5-b79c4afb253d"
AssemblyVersion="1.0.0.0"
AssemblyFileVersion="1.0.0.0" />
</Target>
<Target Name="Math">
<Add Numbers="4;3">
<Output TaskParameter="Result" PropertyName="Result" />
</Add>
<Message Text="Add 4+3= $(Result)"/>
<Add Numbers="4;3;7">
<Output TaskParameter="Result" PropertyName="Result" />
</Add>
<Message Text="Add 4+3+7= $(Result)"/>
<Subtract Numbers="10;3">
<Output TaskParameter="Result" PropertyName="Result" />
</Subtract>
<Message Text="Subtract 10-3= $(Result)"/>
<Multiple Numbers="10;3">
<Output TaskParameter="Result" PropertyName="Result" />
</Multiple>
<Message Text="Multiple 10*3= $(Result)"/>
<Divide Numbers="1;2">
<Output TaskParameter="Result" PropertyName="Result" />
</Divide>
<Message Text="Divide 1/2= $(Result)"/>
</Target>
<Target Name="Version">
<Version VersionFile="version.txt" RevisionType="Increment">
<Output TaskParameter="Major" PropertyName="Major" />
<Output TaskParameter="Minor" PropertyName="Minor" />
<Output TaskParameter="Build" PropertyName="Build" />
<Output TaskParameter="Revision" PropertyName="Revision" />
</Version>
<Message Text="Version: $(Major).$(Minor).$(Build).$(Revision)"/>
</Target>
<Target Name="Registry">
<RegistryRead
KeyName="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework"
ValueName="InstallRoot">
<Output TaskParameter="Value" PropertyName="InstallRoot" />
</RegistryRead>
<Message Text="InstallRoot: $(InstallRoot)"/>
<RegistryWrite
KeyName="HKEY_CURRENT_USER\SOFTWARE\MSBuildTasks"
ValueName="RegistryWrite"
Value="Test Write" />
</Target>
<Target Name="Service">
<ServiceQuery ServiceName="w3svc">
<Output TaskParameter="Status" PropertyName="Status" />
</ServiceQuery>
<Message Text="Web Server: $(Status)"/>
<ServiceController ServiceName="w3svc" Action="Restart" />
</Target>
<Target Name="WebDownload">
<WebDownload FileUri="http://www.microsoft.com/default.aspx"
FileName="microsoft.html" />
</Target>
<Target Name="Attrib" DependsOnTargets="Version">
<Attrib Files="version.txt"
ReadOnly="true" Hidden="true" System="true"/>
<Attrib Files="version.txt"
Hidden="false" System="false"/>
<Attrib Files="version.txt"
Normal="true"/>
</Target>
<PropertyGroup>
<Code>
<![CDATA[
public static void ScriptMain() {
List<string> list = new List<string>();
list.Add("Happy");
list.Add("New");
list.Add("Year");
Console.WriteLine("Hello MSBuild Community Scripting World.");
foreach(string s in list)
{
Console.WriteLine(s);
}
}
]]>
</Code>
</PropertyGroup>
<Target Name="Script">
<Script Language="C#" Code="$(Code)" />
</Target>
<Target Name="Sleep">
<Message Text="Sleep: 200"/>
<Sleep Milliseconds="200" />
</Target>
<ItemGroup>
<ZipFiles Include="**\*.*" Exclude="" />
</ItemGroup>
<Target Name="Zip">
<Zip Files="@(ZipFiles)"
ZipFileName="Sample.zip" />
</Target>
<Target Name="All">
<CallTarget Targets="AssemblyInfo" />
<CallTarget Targets="Math" />
<CallTarget Targets="Version" />
<CallTarget Targets="Registry" />
<CallTarget Targets="Service" />
<CallTarget Targets="WebDownload" />
<CallTarget Targets="Attrib" />
<CallTarget Targets="Script" />
<CallTarget Targets="Sleep" />
<CallTarget Targets="Zip" />
</Target>
</Project>