1 <?xml version=
"1.0" encoding=
"utf-8"?>
2 <Project ToolsVersion=
"14.0" DefaultTargets=
"Build" xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003">
4 <UsingTask TaskName=
"ReplaceInFile" TaskFactory=
"CodeTaskFactory" AssemblyFile=
"$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
6 <Input ParameterType=
"System.String" Required=
"true" />
7 <Output ParameterType=
"System.String" Required=
"true" />
8 <Match ParameterType=
"System.String" Required=
"true" />
9 <Replace ParameterType=
"System.String" Required=
"true" />
12 <Reference Include=
"System.Core" />
13 <Using Namespace=
"System" />
14 <Using Namespace=
"System.IO" />
15 <Using Namespace=
"System.Text.RegularExpressions" />
16 <Code Type=
"Fragment" Language=
"cs">
18 File.WriteAllText(Output, Regex.Replace(File.ReadAllText(Input), Match, Replace));
24 <Import Project=
"$(MSBuildThisFileDirectory)..\eng\Versions.props"/>
25 <Import Project=
"$(MSBuildThisFileDirectory)..\msvc\mono.winconfig.targets"/>
28 <Configuration Condition=
"'$(Configuration)' == ''">Release
</Configuration>
29 <MONO_ENABLE_LLVM Condition=
"'$(MONO_ENABLE_LLVM)' == ''">false
</MONO_ENABLE_LLVM>
30 <DOTNET>$(MSBuildThisFileDirectory)..\.dotnet\dotnet
</DOTNET>
31 <ROSLYN_VERSION>$(MicrosoftNetCompilersVersion)
</ROSLYN_VERSION>
32 <NETCORETESTS_VERSION>$(MicrosoftPrivateCoreFxNETCoreAppVersion)
</NETCORETESTS_VERSION>
33 <NETCOREAPP_VERSION>$(MicrosoftNETCoreAppVersion)
</NETCOREAPP_VERSION>
34 <COREARCH Condition=
"'$(COREARCH)' == ''">x64
</COREARCH>
35 <RID Condition=
"'$(RID)' == ''">win-x64
</RID>
36 <CORLIB_BUILD_FLAGS Condition=
"'$(CORLIB_BUILD_FLAGS)' == ''">-c $(Configuration)
</CORLIB_BUILD_FLAGS>
37 <NETCORESDK_FILE>dotnet-runtime-$(NETCOREAPP_VERSION)-$(RID).zip
</NETCORESDK_FILE>
38 <NETCORE_URL>https://dotnetcli.blob.core.windows.net/dotnet/Runtime/$(NETCOREAPP_VERSION)/$(NETCORESDK_FILE)
</NETCORE_URL>
39 <SHAREDRUNTIME>shared\Microsoft.NETCore.App\$(NETCOREAPP_VERSION)\
</SHAREDRUNTIME>
40 <FEED_BASE_URL>https://dotnetfeed.blob.core.windows.net/dotnet-core
</FEED_BASE_URL>
41 <TEST_ASSETS_PATH>corefx-tests/$(NETCORETESTS_VERSION)/Windows_NT.x64/netcoreapp/corefx-test-assets.xml
</TEST_ASSETS_PATH>
42 <MONO_RUNTIME_BUILD_DIR>$(MSBuildThisFileDirectory)..\msvc\build\sgen\$(COREARCH)\Bin\$(Configuration)\
</MONO_RUNTIME_BUILD_DIR>
43 <MONO_PRIVATE_CORLIB_BUILD_DIR>$(MSBuildThisFileDirectory)System.Private.CoreLib\bin\$(COREARCH)\
</MONO_PRIVATE_CORLIB_BUILD_DIR>
46 <Target Name=
"configure-mono-environment-source"
47 Inputs=
"$(MSBuildThisFileDirectory)..\configure.ac;$(MSBuildThisFileDirectory)System.Private.CoreLib\src\System\Environment.Mono.in"
48 Outputs=
"$(MSBuildThisFileDirectory)System.Private.CoreLib\src\System\Environment.Mono.cs">
49 <GetVersionsFromConfigureAC ConfigFileRoot=
"$(MSBuildThisFileDirectory)..\">
50 <Output TaskParameter=
"MonoVersion" PropertyName=
"_MonoVersion" />
51 <Output TaskParameter=
"MonoCorlibVersion" PropertyName=
"_MonoCorlibVersion" />
52 </GetVersionsFromConfigureAC>
55 Input=
"$(MSBuildThisFileDirectory)System.Private.CoreLib\src\System\Environment.Mono.in"
56 Output=
"$(MSBuildThisFileDirectory)System.Private.CoreLib\src\System\Environment.Mono.cs"
57 Match=
"@MONO_CORLIB_VERSION@"
58 Replace=
"$(_MonoCorlibVersion)" />
61 <Target Name=
"init-tools">
62 <Exec Command=
"powershell -NoProfile -NoLogo -ExecutionPolicy ByPass -Command "$(MSBuildThisFileDirectory)init-tools.ps1"">
63 <Output TaskParameter=
"ExitCode" PropertyName=
"_ExitCode" />
67 <Target Name=
"update-roslyn"
68 Condition=
"!Exists('$(MSBuildThisFileDirectory)roslyn\packages\microsoft.net.compilers.toolset\$(ROSLYN_VERSION)\microsoft.net.compilers.toolset.nuspec')"
69 DependsOnTargets=
"init-tools">
71 <_UpdateRoslynArgs>"$(MSBuildThisFileDirectory)roslyn-restore.csproj
"</_UpdateRoslynArgs>
72 <_UpdateRoslynArgs>$(_UpdateRoslynArgs) -p:RoslynVersion=$(ROSLYN_VERSION)
</_UpdateRoslynArgs>
73 <_UpdateRoslynArgs>$(_UpdateRoslynArgs) --packages
"$(MSBuildThisFileDirectory)roslyn\packages
"</_UpdateRoslynArgs>
74 <_UpdateRoslynArgs>$(_UpdateRoslynArgs) -p:OutputPath=
"$(MSBuildThisFileDirectory)roslyn\restore
"</_UpdateRoslynArgs>
76 <Exec Command=
"$(DOTNET) restore $(_UpdateRoslynArgs)">
77 <Output TaskParameter=
"ExitCode" PropertyName=
"_ExitCode" />
81 <Target Name=
"update-corefx"
82 Inputs=
"$(MSBuildThisFileDirectory)corefx-restore.csproj"
83 Outputs=
"$(MSBuildThisFileDirectory)corefx\.stamp-dl-corefx-$(NETCORETESTS_VERSION)"
84 DependsOnTargets=
"init-tools">
86 <_UpdateCoreFxArgs>"$(MSBuildThisFileDirectory)corefx-restore.csproj
"</_UpdateCoreFxArgs>
87 <_UpdateCoreFxArgs>$(_UpdateCoreFxArgs) --runtime $(RID)
</_UpdateCoreFxArgs>
88 <_UpdateCoreFxArgs>$(_UpdateCoreFxArgs) --packages
"$(MSBuildThisFileDirectory)corefx\packages
"</_UpdateCoreFxArgs>
89 <_UpdateCoreFxArgs>$(_UpdateCoreFxArgs) -p:MicrosoftPrivateCoreFxNETCoreAppVersion=$(NETCORETESTS_VERSION)
</_UpdateCoreFxArgs>
90 <_UpdateCoreFxArgs>$(_UpdateCoreFxArgs) -p:OutputPath=
"$(MSBuildThisFileDirectory)corefx\restore
"</_UpdateCoreFxArgs>
92 <Exec Command=
"$(DOTNET) build $(_UpdateCoreFxArgs)">
93 <Output TaskParameter=
"ExitCode" PropertyName=
"_ExitCode" />
95 <Touch Files=
"$(MSBuildThisFileDirectory)corefx\.stamp-dl-corefx-$(NETCORETESTS_VERSION)" AlwaysCreate=
"true" />
98 <Target Name=
"download-unzip-netcore-sdk"
99 Condition=
"!Exists('$(MSBuildThisFileDirectory)$(NETCORESDK_FILE)')">
100 <DownloadFile SourceUrl=
"$(NETCORE_URL)" DestinationFolder=
"$(MSBuildThisFileDirectory)" DestinationFileName=
"$(NETCORESDK_FILE)" />
101 <Unzip SourceFiles=
"$(MSBuildThisFileDirectory)$(NETCORESDK_FILE)" DestinationFolder=
"$(MSBuildThisFileDirectory)" OverwriteReadOnlyFiles=
"true" />
104 <Target Name=
"update-netcore-sdk"
105 Condition=
"!Exists('$(MSBuildThisFileDirectory)$(NETCORESDK_FILE)')">
107 <_UpdateNetCoreSdkArgs>"$(MSBuildThisFileDirectory)build.targets
"</_UpdateNetCoreSdkArgs>
108 <_UpdateNetCoreSdkArgs>$(_UpdateNetCoreSdkArgs) /t:download-unzip-netcore-sdk
</_UpdateNetCoreSdkArgs>
110 <RemoveDir Directories=
"$(MSBuildThisFileDirectory)shared\Microsoft.NETCore.App" />
111 <Exec Command=
"$(DOTNET) msbuild $(_UpdateNetCoreSdkArgs)">
112 <Output TaskParameter=
"ExitCode" PropertyName=
"_ExitCode" />
116 <Target Name=
"update-tests-corefx"
117 Inputs=
"$(MSBuildThisFileDirectory)corefx-tests-restore.proj"
118 Outputs=
"$(MSBuildThisFileDirectory)corefx\.stamp-dl-corefx-tests-$(NETCORETESTS_VERSION)"
119 DependsOnTargets=
"init-tools">
121 <_UpdateTestsCoreFxArgs>"$(MSBuildThisFileDirectory)corefx-tests-restore.proj
"</_UpdateTestsCoreFxArgs>
122 <_UpdateTestsCoreFxArgs>$(_UpdateTestsCoreFxArgs) -m
</_UpdateTestsCoreFxArgs>
123 <_UpdateTestsCoreFxArgs>$(_UpdateTestsCoreFxArgs) -t:DownloadAllTests
</_UpdateTestsCoreFxArgs>
124 <_UpdateTestsCoreFxArgs>$(_UpdateTestsCoreFxArgs) -p:TEST_ASSETS_PATH=
"$(TEST_ASSETS_PATH)
"</_UpdateTestsCoreFxArgs>
125 <_UpdateTestsCoreFxArgs>$(_UpdateTestsCoreFxArgs) -p:FEED_BASE_URL=
"$(FEED_BASE_URL)
"</_UpdateTestsCoreFxArgs>
127 <RemoveDir Directories=
"$(MSBuildThisFileDirectory)corefx\tests" />
128 <Exec Command=
"$(DOTNET) msbuild $(_UpdateTestsCoreFxArgs)">
129 <Output TaskParameter=
"ExitCode" PropertyName=
"_ExitCode" />
131 <RemoveDir Directories=
"$(MSBuildThisFileDirectory)corefx\tests\extracted\System.Utf8String.Experimental.Tests" />
132 <Touch Files=
"$(MSBuildThisFileDirectory)corefx\.stamp-dl-corefx-tests-$(NETCORETESTS_VERSION)" AlwaysCreate=
"true" />
135 <Target Name=
"bcl" DependsOnTargets=
"init-tools;update-roslyn;configure-mono-environment-source">
137 <_CorlibBuildArgs>-p:TargetsWindows=true
</_CorlibBuildArgs>
138 <_CorlibBuildArgs>$(_CorlibBuildArgs) $(CORLIB_BUILD_FLAGS)
</_CorlibBuildArgs>
139 <_CorlibBuildArgs>$(_CorlibBuildArgs) -p:BuildArch=$(COREARCH)
</_CorlibBuildArgs>
140 <_CorlibBuildArgs>$(_CorlibBuildArgs) -p:OutputPath=bin\$(COREARCH)
</_CorlibBuildArgs>
141 <_CorlibBuildArgs>$(_CorlibBuildArgs) -p:RoslynPropsFile=
"$(MSBuildThisFileDirectory)\roslyn\packages\microsoft.net.compilers.toolset\$(ROSLYN_VERSION)\build\Microsoft.Net.Compilers.Toolset.props
"</_CorlibBuildArgs>
142 <_CorlibBuildArgs>$(_CorlibBuildArgs)
"$(MSBuildThisFileDirectory)System.Private.CoreLib\System.Private.CoreLib.csproj
"</_CorlibBuildArgs>
145 <Exec Command=
"$(DOTNET) build $(_CorlibBuildArgs)">
146 <Output TaskParameter=
"ExitCode" PropertyName=
"_ExitCode" />
150 <Target Name=
"build-runtime">
152 <RuntimeBuildTarget Condition=
"'$(RuntimeBuildTarget)' == ''">build
</RuntimeBuildTarget>
154 <MSBuild Projects=
"$(MSBuildThisFileDirectory)..\msvc\mono.sln" Targets=
"$(RuntimeBuildTarget)" Properties=
"Platform=$(COREARCH);Configuration=$(Configuration);MONO_TARGET_GC=sgen;MONO_ENABLE_LLVM=$(MONO_ENABLE_LLVM);MONO_ENABLE_NETCORE=true"/>
157 <Target Name=
"link-mono">
158 <Error Text=
"Missing Mono MSVC runtime build." Condition=
"!Exists('$(MONO_RUNTIME_BUILD_DIR)mono-2.0-sgen.dll')" />
159 <Error Text=
"Missing Mono System.Private.CoreLib build." Condition=
"!Exists('$(MONO_PRIVATE_CORLIB_BUILD_DIR)System.Private.CoreLib.dll')" />
160 <Copy SourceFiles=
"$(MONO_RUNTIME_BUILD_DIR)mono-2.0-sgen.dll" DestinationFiles=
"$(SHAREDRUNTIME)coreclr.dll" SkipUnchangedFiles=
"true" />
161 <Copy SourceFiles=
"$(MONO_RUNTIME_BUILD_DIR)mono-2.0-sgen.pdb" DestinationFiles=
"$(SHAREDRUNTIME)coreclr.pdb" SkipUnchangedFiles=
"true" />
162 <Copy SourceFiles=
"$(MONO_PRIVATE_CORLIB_BUILD_DIR)System.Private.CoreLib.dll" DestinationFiles=
"$(SHAREDRUNTIME)System.Private.CoreLib.dll" SkipUnchangedFiles=
"true" />
163 <Copy SourceFiles=
"$(MONO_PRIVATE_CORLIB_BUILD_DIR)System.Private.CoreLib.pdb" DestinationFiles=
"$(SHAREDRUNTIME)System.Private.CoreLib.pdb" SkipUnchangedFiles=
"true" />
166 <Target Name=
"prepare" DependsOnTargets=
"update-netcore-sdk;update-corefx;update-roslyn;link-mono" />
168 <!-- To run an individual test, set property CoreFxTests to the name of the test to execute -->
169 <Target Name=
"run-tests-corefx" DependsOnTargets=
"prepare;update-tests-corefx">
171 <CoreFxTests Condition=
"'$(CoreFxTests)' == ''">*
</CoreFxTests>
172 <CoreFxTestTimeout Condition=
"'$(CoreFxTestTimeout)' == ''">-
1</CoreFxTestTimeout>
173 <_RunTestsCoreFxArgs>(set MONO_ENV_OPTIONS=
"--debug
")
& (set COMPlus_DebugWriteToStdErr=
1)
& </_RunTestsCoreFxArgs>
174 <_RunTestsCoreFxArgs>$(_RunTestsCoreFxArgs) powershell -NoProfile -NoLogo -ExecutionPolicy ByPass -Command
"$(MSBuildThisFileDirectory)run-tests-corefx.ps1
"</_RunTestsCoreFxArgs>
175 <_RunTestsCoreFxArgs>$(_RunTestsCoreFxArgs) -fxversion
"$(NETCOREAPP_VERSION)
" -timeout $(CoreFxTestTimeout) -corefxtests
"$(CoreFxTests)
"</_RunTestsCoreFxArgs>
178 <Exec Command=
"$(_RunTestsCoreFxArgs)">
179 <Output TaskParameter=
"ExitCode" PropertyName=
"_ExitCode" />
183 <Target Name=
"Clean">
184 <RemoveDir Directories=
"$(MSBuildThisFileDirectory)..\.dotnet" />
185 <RemoveDir Directories=
"$(MSBuildThisFileDirectory)sdk" />
186 <RemoveDir Directories=
"$(MSBuildThisFileDirectory)shared" />
187 <RemoveDir Directories=
"$(MSBuildThisFileDirectory)host" />
188 <RemoveDir Directories=
"$(MSBuildThisFileDirectory)dotnet" />
189 <RemoveDir Directories=
"$(MSBuildThisFileDirectory)corefx" />
190 <RemoveDir Directories=
"$(MSBuildThisFileDirectory)roslyn" />
191 <RemoveDir Directories=
"$(MSBuildThisFileDirectory)System.Private.CoreLib\bin" />
192 <Delete Files=
"$(MSBuildThisFileDirectory)$(NETCORESDK_FILE)" />
193 <Delete Files=
"$(MSBuildThisFileDirectory)LICENSE.txt" />
194 <Delete Files=
"$(MSBuildThisFileDirectory)ThirdPartyNotices.txt" />
195 <Delete Files=
"$(MSBuildThisFileDirectory).failures" />
198 <Target Name=
"Build" DependsOnTargets=
"prepare;bcl" />