-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
GenerateLayout.targets
524 lines (451 loc) · 29.6 KB
/
GenerateLayout.targets
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
<Project>
<ItemGroup>
<PackageDownload Include="Microsoft.NETCore.Platforms" Version="[$(MicrosoftNETCorePlatformsPackageVersion)]" />
</ItemGroup>
<Target Name="PublishPortableRuntimeIdentifierGraph"
BeforeTargets="Build">
<Copy SourceFiles="$(NuGetPackageRoot)/microsoft.netcore.platforms/$(MicrosoftNETCorePlatformsPackageVersion)/runtime.json"
DestinationFiles="$(OutputPath)RuntimeIdentifierGraph.json"
SkipUnchangedFiles="true" />
<Copy SourceFiles="$(NuGetPackageRoot)/microsoft.netcore.platforms/$(MicrosoftNETCorePlatformsPackageVersion)/PortableRuntimeIdentifierGraph.json"
DestinationFolder="$(OutputPath)"
SkipUnchangedFiles="true" />
</Target>
<Target Name="PublishVersionFile"
BeforeTargets="Build">
<WriteLinesToFile File="$(OutputPath)/.toolsetversion"
Lines="$(SourceRevisionId);$(Version);$(Rid)"
Overwrite="true" />
<!-- The .version file in the final product will be the .NET Core SDK version. But
for the layout we produce here, use the toolset information, so that we don't
just always use the stage 0 version. -->
<WriteLinesToFile File="$(OutputPath)/.version"
Lines="$(SourceRevisionId);$(Version);$(Rid)"
Overwrite="true" />
<!-- Development env and CI loads DotnetFiles type from the following location
The resolution of the product version (https://github.com/dotnet/sdk/blob/main/src/Cli/Microsoft.DotNet.Cli.Utils/DotnetFiles.cs#L21)
then need the version file there as well. -->
<Copy SourceFiles="$(OutputPath)/.version" DestinationFiles="$(BaseOutputPath)$(Configuration)/.version" SkipUnchangedFiles="true" />
</Target>
<Target Name="PublishRoslyn"
BeforeTargets="Build">
<PropertyGroup>
<RoslynDirectory>$(OutputPath)/Roslyn</RoslynDirectory>
</PropertyGroup>
<ItemGroup>
<RoslynBits Include="$(NuGetPackageRoot)/microsoft.net.compilers.toolset/$(MicrosoftNetCompilersToolsetVersion)/tasks/netcore/**/*" />
</ItemGroup>
<Error Condition="'@(RoslynBits)' == ''" Text="Something moved around in Roslyn package, adjust code here accordingly. TFM change?" />
<Copy SourceFiles="@(RoslynBits)" DestinationFiles="@(RoslynBits->'$(RoslynDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
<ItemGroup>
<RoslynFrameworkAssemblies Include="$(RoslynDirectory)/System.*.dll;$(RoslynDirectory)/runtimes/**/System.*.dll" Exclude="$(RoslynDirectory)/runtimes/**/System.IO.Pipes.AccessControl.dll"/>
</ItemGroup>
<Delete Files="@(RoslynFrameworkAssemblies)" />
</Target>
<Target Name="PublishNETAnalyzers"
BeforeTargets="Build;PublishNetSdk">
<PropertyGroup>
<AnalyzerAssembliesDirectory>$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk\analyzers</AnalyzerAssembliesDirectory>
<AnalyzerTargetsDirectory>$(AnalyzerAssembliesDirectory)\build</AnalyzerTargetsDirectory>
<AnalyzerConfigDirectory>$(AnalyzerTargetsDirectory)\config</AnalyzerConfigDirectory>
<CodeStyleAssembliesCSharpDirectory>$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk\codestyle\cs</CodeStyleAssembliesCSharpDirectory>
<CodeStyleAssembliesVisualBasicDirectory>$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk\codestyle\vb</CodeStyleAssembliesVisualBasicDirectory>
<CodeStyleCSharpTargetsDirectory>$(CodeStyleAssembliesCSharpDirectory)\build</CodeStyleCSharpTargetsDirectory>
<CodeStyleVisualBasicTargetsDirectory>$(CodeStyleAssembliesVisualBasicDirectory)\build</CodeStyleVisualBasicTargetsDirectory>
<CodeStyleCSharpConfigDirectory>$(CodeStyleCSharpTargetsDirectory)\config</CodeStyleCSharpConfigDirectory>
<CodeStyleVisualBasicConfigDirectory>$(CodeStyleVisualBasicTargetsDirectory)\config</CodeStyleVisualBasicConfigDirectory>
</PropertyGroup>
<ItemGroup>
<AnalyzerAssemblies Include="$(PkgMicrosoft_CodeAnalysis_NetAnalyzers)/analyzers/dotnet/cs/**/*.dll" />
<AnalyzerAssemblies Include="$(PkgMicrosoft_CodeAnalysis_NetAnalyzers)/analyzers/dotnet/vb/Microsoft.CodeAnalysis.VisualBasic.NetAnalyzers.dll" />
<AnalyzerTargets Include="$(PkgMicrosoft_CodeAnalysis_NetAnalyzers)/buildTransitive/Microsoft.CodeAnalysis.NetAnalyzers.props" />
<AnalyzerTargets Include="$(PkgMicrosoft_CodeAnalysis_NetAnalyzers)/buildTransitive/Microsoft.CodeAnalysis.NetAnalyzers.targets" />
<AnalyzerConfig Include="$(PkgMicrosoft_CodeAnalysis_NetAnalyzers)/buildTransitive/config/**/*" />
<CodeStyleCSharpAssemblies Include="$(PkgMicrosoft_CodeAnalysis_CSharp_CodeStyle)/analyzers/dotnet/cs/**/*.dll" />
<CodeStyleVisualBasicAssemblies Include="$(PkgMicrosoft_CodeAnalysis_VisualBasic_CodeStyle)/analyzers/dotnet/vb/**/*.dll" />
<!-- The props files from these packages explicitly say they should never be included in the SDK -->
<CodeStyleCSharpTargets Include="$(PkgMicrosoft_CodeAnalysis_CSharp_CodeStyle)/build/Microsoft.CodeAnalysis.CSharp.CodeStyle.targets" />
<CodeStyleVisualBasicTargets Include="$(PkgMicrosoft_CodeAnalysis_VisualBasic_CodeStyle)/build/Microsoft.CodeAnalysis.VisualBasic.CodeStyle.targets" />
<!-- The files in the build/config folder are identical across packages -->
<CodeStyleCSharpConfig Include="$(PkgMicrosoft_CodeAnalysis_CSharp_CodeStyle)/build/config/**/*" />
<CodeStyleVisualBasicConfig Include="$(PkgMicrosoft_CodeAnalysis_VisualBasic_CodeStyle)/build/config/**/*" />
</ItemGroup>
<Error Condition="'@(AnalyzerAssemblies)' == ''" Text="Something moved around in Analyzer package, adjust code here accordingly. TFM change?" />
<Error Condition="'@(AnalyzerTargets)' == ''" Text="Something moved around in Analyzer package, adjust code here accordingly. TFM change?" />
<Error Condition="'@(AnalyzerConfig)' == ''" Text="Something moved around in Analyzer package, adjust code here accordingly. TFM change?" />
<Error Condition="'@(CodeStyleCSharpAssemblies)' == ''" Text="Something moved around in the C# Code style package, could not find assembles. Adjust code here accordingly. TFM change?" />
<Error Condition="'@(CodeStyleVisualBasicAssemblies)' == ''" Text="Something moved around in the VB Code style package, could not find assembles. Adjust code here accordingly. TFM change?" />
<Error Condition="'@(CodeStyleCSharpTargets)' == ''" Text="Something moved around in Code style packeges, could not find targets/props. Adjust code here accordingly. TFM change?" />
<Error Condition="'@(CodeStyleVisualBasicTargets)' == ''" Text="Something moved around in Code style packeges, could not find targets/props. Adjust code here accordingly. TFM change?" />
<Error Condition="'@(CodeStyleCSharpConfig)' == ''" Text="Something moved around in Code style packeges, could not find globalconfig files. Adjust code here accordingly. TFM change?" />
<Error Condition="'@(CodeStyleVisualBasicConfig)' == ''" Text="Something moved around in Code style packeges, could not find globalconfig files. Adjust code here accordingly. TFM change?" />
<Copy SourceFiles="@(AnalyzerAssemblies)" DestinationFiles="@(AnalyzerAssemblies->'$(AnalyzerAssembliesDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(AnalyzerTargets)" DestinationFiles="@(AnalyzerTargets->'$(AnalyzerTargetsDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(AnalyzerConfig)" DestinationFiles="@(AnalyzerConfig->'$(AnalyzerConfigDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(CodeStyleCSharpAssemblies)" DestinationFiles="@(CodeStyleCSharpAssemblies->'$(CodeStyleAssembliesCSharpDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(CodeStyleVisualBasicAssemblies)" DestinationFiles="@(CodeStyleVisualBasicAssemblies->'$(CodeStyleAssembliesVisualBasicDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(CodeStyleCSharpTargets)" DestinationFiles="@(CodeStyleCSharpTargets->'$(CodeStyleCSharpTargetsDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(CodeStyleVisualBasicTargets)" DestinationFiles="@(CodeStyleVisualBasicTargets->'$(CodeStyleVisualBasicTargetsDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(CodeStyleCSharpConfig)" DestinationFiles="@(CodeStyleCSharpConfig->'$(CodeStyleCSharpConfigDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(CodeStyleVisualBasicConfig)" DestinationFiles="@(CodeStyleVisualBasicConfig->'$(CodeStyleVisualBasicConfigDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(ILLinkAnalyzersTargets)" DestinationFiles="@(ILLinkAnalyzersTargets->'$(AnalyzerTargetsDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(ILLinkAnalyzersAssemblies)" DestinationFiles="@(ILLinkAnalyzersAssemblies->'$(AnalyzerAssembliesDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="PublishDotnetFormat" AfterTargets="Build" BeforeTargets="PublishNetSdk">
<PropertyGroup>
<DotnetFormatDestinationDirectory>$(OutputPath)/DotnetTools/dotnet-format</DotnetFormatDestinationDirectory>
</PropertyGroup>
<ItemGroup>
<DotnetFormatDllFiles Include="$(ArtifactsBinDir)/dotnet-format/$(Configuration)/$(NetCurrent)/**/*.dll" />
<DotnetFormatDllFiles Include="$(ArtifactsBinDir)/dotnet-format/$(Configuration)/$(NetCurrent)/**/*.exe" />
<DotnetFormatConfigFiles Include="$(ArtifactsBinDir)/dotnet-format/$(Configuration)/$(NetCurrent)/**/*.json" />
<DotnetFormatConfigFiles Include="$(ArtifactsBinDir)/dotnet-format/$(Configuration)/$(NetCurrent)/**/*.config" />
</ItemGroup>
<Copy SourceFiles="@(DotnetFormatDllFiles)" DestinationFiles="@(DotnetFormatDllFiles->'$(DotnetFormatDestinationDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(DotnetFormatConfigFiles)" DestinationFiles="@(DotnetFormatConfigFiles->'$(DotnetFormatDestinationDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="PublishMSBuildExtensions"
DependsOnTargets="GenerateMSBuildExtensions"
BeforeTargets="Build">
<Copy SourceFiles="@(MSBuildExtensionsContent)"
DestinationFiles="@(MSBuildExtensionsContent->'$(OutputPath)\%(DeploymentSubpath)\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="PublishNetSdks"
BeforeTargets="Build">
<ItemGroup>
<WebSdkProjectFile Include="$(RepoRoot)src\WebSdk\**\*.csproj" />
</ItemGroup>
<MSBuild Projects="@(WebSdkProjectFile)" />
<PropertyGroup>
<NETSdkSourceRoot>$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk</NETSdkSourceRoot>
<NETSdkWebSourceRoot>$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk.Web</NETSdkWebSourceRoot>
<NETSdkPublishSourceRoot>$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk.Publish</NETSdkPublishSourceRoot>
<NETSdkWebProjectSystemSourceRoot>$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk.Web.ProjectSystem</NETSdkWebProjectSystemSourceRoot>
<NETSdkWorkerSourceRoot>$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk.Worker</NETSdkWorkerSourceRoot>
<NETSdkBlazorWasmSourceRoot>$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly</NETSdkBlazorWasmSourceRoot>
<NETSdkWasmSourceRoot>$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk.WebAssembly</NETSdkWasmSourceRoot>
<NETSdkRazorSourceRoot>$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk.Razor</NETSdkRazorSourceRoot>
<NETSdkStaticWebAssetsSourceRoot>$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk.StaticWebAssets</NETSdkStaticWebAssetsSourceRoot>
</PropertyGroup>
<ItemGroup>
<NETSdksContent Include="$(NETSdkSourceRoot)\**\*.*"
DeploymentSubPath="Sdks\Microsoft.NET.Sdk"/>
<NETSdksContent Include="$(NETSdkWebSourceRoot)\**\*.*"
DeploymentSubPath="Sdks\Microsoft.NET.Sdk.Web"/>
<NETSdksContent Include="$(NETSdkPublishSourceRoot)\**\*.*"
DeploymentSubPath="Sdks\Microsoft.NET.Sdk.Publish"/>
<NETSdksContent Include="$(NETSdkWebProjectSystemSourceRoot)\**\*.*"
DeploymentSubPath="Sdks\Microsoft.NET.Sdk.Web.ProjectSystem"/>
<NETSdksContent Include="$(NETSdkWorkerSourceRoot)\**\*.*"
DeploymentSubPath="Sdks\Microsoft.NET.Sdk.Worker"/>
<NETSdksContent Include="$(NETSdkBlazorWasmSourceRoot)\**\*.*"
DeploymentSubPath="Sdks\Microsoft.NET.Sdk.BlazorWebAssembly"/>
<NETSdksContent Include="$(NETSdkWasmSourceRoot)\**\*.*"
DeploymentSubPath="Sdks\Microsoft.NET.Sdk.WebAssembly"/>
<NETSdksContent Include="$(NETSdkRazorSourceRoot)\**\*.*"
DeploymentSubPath="Sdks\Microsoft.NET.Sdk.Razor"/>
<NETSdksContent Include="$(NETSdkStaticWebAssetsSourceRoot)\**\*.*"
DeploymentSubPath="Sdks\Microsoft.NET.Sdk.StaticWebAssets"/>
</ItemGroup>
<Copy SourceFiles="@(NETSdksContent)"
DestinationFiles="@(NETSdksContent->'$(OutputPath)\%(DeploymentSubpath)\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="PublishTestCli"
BeforeTargets="Build">
<PropertyGroup>
<TestCliNuGetDirectoryTargetFramework Condition="'$(DotNetBuildSourceOnly)' != 'true'" >netcoreapp3.1</TestCliNuGetDirectoryTargetFramework>
<TestCliNuGetDirectoryTargetFramework Condition="'$(DotNetBuildSourceOnly)' == 'true' and '$(DotNetBuildOrchestrator)' == 'true'" >$(NetCurrent)</TestCliNuGetDirectoryTargetFramework>
<TestCliNuGetDirectoryTargetFramework Condition="'$(DotNetBuildSourceOnly)' == 'true' and '$(DotNetBuildOrchestrator)' != 'true'" >net9.0</TestCliNuGetDirectoryTargetFramework>
<TestCliNuGetDirectory>$(NuGetPackageRoot)/microsoft.testplatform.cli/$(MicrosoftTestPlatformCLIPackageVersion)/contentFiles/any/$(TestCliNuGetDirectoryTargetFramework)/</TestCliNuGetDirectory>
</PropertyGroup>
<ItemGroup>
<!-- https://github.com/microsoft/vstest/issues/1886 -->
<TestCliBitsToExclude Include="$(TestCliNuGetDirectory)NewtonSoft.Json.dll" />
<TestCliBitsToExclude Include="$(TestCliNuGetDirectory)Microsoft.Extensions.DependencyModel.dll" />
<TestCliBitsToExclude Include="$(TestCliNuGetDirectory)Microsoft.Extensions.FileSystemGlobbing.dll" />
<TestCliBitsToExclude Include="$(TestCliNuGetDirectory)System.Memory.dll" />
<TestCliBitsToExclude Include="$(TestCliNuGetDirectory)System.Runtime.CompilerServices.Unsafe.dll" />
<TestCliBitsToExclude Include="$(TestCliNuGetDirectory)NuGet.Frameworks.dll" />
<TestCliBitsToExclude Include="$(TestCliNuGetDirectory)System.Text.Json.dll" />
<TestCliBits Include="$(TestCliNuGetDirectory)**/*"
Exclude="@(TestCliBitsToExclude)" />
</ItemGroup>
<Error Condition="'@(TestCliBits)' == ''" Text="Something moved around in Test CLI package, adjust code here accordingly. TFM change?" />
<Copy SourceFiles="@(TestCliBits)" DestinationFiles="@(TestCliBits->'$(OutputPath)/%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="PublishFSharp"
BeforeTargets="Build">
<MSBuild
Targets="Publish"
Projects="$(RepoRoot)/src/Layout/tool_fsharp/tool_fsc.csproj"
Properties="Configuration=$(Configuration);PublishDir=$(OutputPath)/FSharp" />
</Target>
<Target Name="PublishContainersSdk"
BeforeTargets="Build">
<ItemGroup>
<BuildFiles Include="$(RepoRoot)/src/Containers/packaging/build/Microsoft.NET.Build.Containers.props" />
<BuildFiles Include="$(RepoRoot)/src/Containers/packaging/build/Microsoft.NET.Build.Containers.targets" />
</ItemGroup>
<Copy SourceFiles="@(BuildFiles)" DestinationFolder="$(OutputPath)/Containers/build" />
<MSBuild
Targets="Publish"
Projects="$(RepoRoot)/src/Containers/Microsoft.NET.Build.Containers/Microsoft.NET.Build.Containers.csproj"
Properties="Configuration=$(Configuration);PublishDir=$(OutputPath)/Containers/tasks/net472;TargetFramework=net472"
Condition="'$(OSName)' == 'win'" />
<MSBuild
Targets="Publish"
Projects="$(RepoRoot)/src/Containers/Microsoft.NET.Build.Containers/Microsoft.NET.Build.Containers.csproj"
Properties="Configuration=$(Configuration);PublishDir=$(OutputPath)/Containers/tasks/$(SdkTargetFramework);TargetFramework=$(SdkTargetFramework)" />
<MSBuild
Targets="Publish"
Projects="$(RepoRoot)/src/Containers/containerize/containerize.csproj"
Properties="Configuration=$(Configuration);PublishDir=$(OutputPath)/Containers/containerize"
Condition="'$(OSName)' == 'win'" />
</Target>
<Target Name="GenerateCliRuntimeConfigurationFiles"
AfterTargets="Build">
<RemoveAssetFromDepsPackages DepsFile="$(OutputPath)/$(TargetName).deps.json"
SectionName="runtime"
AssetPath="%(BundledToolProjects.Identity).dll" />
<Copy SourceFiles="$(OutputPath)/$(TargetName).deps.json"
DestinationFiles="$(OutputPath)/%(BundledTools.Identity).deps.json" />
<Copy SourceFiles="$(OutputPath)/$(TargetName).runtimeconfig.json"
DestinationFiles="$(OutputPath)/%(BundledTools.Identity).runtimeconfig.json" />
<Delete Files="$(OutputPath)/$(TargetName).deps.json;
$(OutputPath)/$(TargetName).runtimeconfig.json" />
<Delete Files="$(OutputPath)/%(BundledToolProjects.Identity).dll;
$(OutputPath)/%(BundledToolProjects.Identity).pdb" />
<ChangeEntryPointLibraryName
DepsFile="$(OutputPath)/%(BundledTools.Identity).deps.json"
NewName="%(BundledTools.Identity).deps.json" />
</Target>
<Target Name="RemoveResourcesFromDotnetDeps"
AfterTargets="Build">
<RemoveAssetFromDepsPackages DepsFile="$(OutputPath)/dotnet.deps.json"
SectionName="resources"
AssetPath="*" />
</Target>
<Target Name="MakeFscRunnableAndMoveToPublishDir"
AfterTargets="Build"
BeforeTargets="RemoveFilesAfterPublish">
<PropertyGroup>
<FSharpDirectory>$(OutputPath)/FSharp</FSharpDirectory>
</PropertyGroup>
<ItemGroup>
<AssetsToRemoveFromDeps Include="tool_fsc.dll"
SectionName="runtime"/>
</ItemGroup>
<RemoveAssetFromDepsPackages DepsFile="$(FSharpDirectory)/tool_fsc.deps.json"
SectionName="%(AssetsToRemoveFromDeps.SectionName)"
AssetPath="%(AssetsToRemoveFromDeps.Identity)" />
<!-- Deploy deps and runtime config for fsc.exe and fsi.exe. Both apps have exactly the same dependencies so this is Ok -->
<Copy SourceFiles="$(FSharpDirectory)/tool_fsc.runtimeconfig.json;
$(FSharpDirectory)/tool_fsc.deps.json;"
DestinationFiles="$(FSharpDirectory)/fsc.runtimeconfig.json;
$(FSharpDirectory)/fsc.deps.json;"/>
<Copy SourceFiles="$(FSharpDirectory)/tool_fsc.runtimeconfig.json;
$(FSharpDirectory)/tool_fsc.deps.json;"
DestinationFiles="$(FSharpDirectory)/fsi.runtimeconfig.json;
$(FSharpDirectory)/fsi.deps.json;"/>
</Target>
<Target Name="RemoveFscFilesAfterPublish"
AfterTargets="Build">
<Delete Files="$(FSharpDirectory)/tool_fsc.dll" />
<Delete Files="$(FSharpDirectory)/tool_fsc.pdb" />
<Delete Files="$(FSharpDirectory)/tool_fsc.runtimeconfig.json" />
<Delete Files="$(FSharpDirectory)/tool_fsc.deps.json" />
</Target>
<Target Name="PublishBlazorWasmTools"
BeforeTargets="PublishNetSdks">
<MSBuild
Targets="Publish"
Projects="$(RepoRoot)/src/BlazorWasmSdk/Tool/Microsoft.NET.Sdk.BlazorWebAssembly.Tool.csproj"
Properties="Configuration=$(Configuration)" />
</Target>
<Target Name="MoveBlazorWasmTools" AfterTargets="PublishBlazorWasmTools">
<ItemGroup>
<_WebAssemblyToolsOutput Include="$(ArtifactsBinDir)Microsoft.NET.Sdk.BlazorWebAssembly.Tool\$(Configuration)\$(SdkTargetFramework)\publish\*.*" />
</ItemGroup>
<Error
Text="WebAssembly SDK tools outputs were not found in $(ArtifactsBinDir)Microsoft.NET.Sdk.BlazorWebAssembly.Tool\$(Configuration)\$(SdkTargetFramework)\publish"
Condition="'@(_WebAssemblyToolsOutput->Count())' == '0'" />
<Copy
SourceFiles="@(_WebAssemblyToolsOutput)"
DestinationFolder="$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\tools\$(SdkTargetFramework)\"
SkipUnchangedFiles="true" />
</Target>
<Target Name="PublishStaticWebAssetsTools"
BeforeTargets="PublishNetSdks">
<MSBuild
Targets="Publish"
Projects="$(RepoRoot)/src/StaticWebAssetsSdk/Tool/Microsoft.NET.Sdk.StaticWebAssets.Tool.csproj"
Properties="Configuration=$(Configuration)" />
</Target>
<Target Name="MoveStaticWebAssetsTools" AfterTargets="PublishStaticWebAssetsTools">
<ItemGroup>
<_StaticWebAssetsToolsOutput Include="$(ArtifactsBinDir)Microsoft.NET.Sdk.StaticWebAssets.Tool\$(Configuration)\$(SdkTargetFramework)\publish\*.*" />
</ItemGroup>
<Error
Text="StaticWebAssets SDK tools outputs were not found in $(ArtifactsBinDir)Microsoft.NET.Sdk.StaticWebAssets.Tool\$(Configuration)\$(SdkTargetFramework)\publish"
Condition="'@(_StaticWebAssetsToolsOutput->Count())' == '0'" />
<Copy
SourceFiles="@(_StaticWebAssetsToolsOutput)"
DestinationFolder="$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk.StaticWebAssets\tools\$(SdkTargetFramework)\"
SkipUnchangedFiles="true" />
</Target>
<Target Name="PublishRazorSdkTools"
BeforeTargets="PublishNetSdks">
<MSBuild
Targets="Publish"
Projects="$(RepoRoot)/src/RazorSdk/Tool/Microsoft.NET.Sdk.Razor.Tool.csproj"
Properties="Configuration=$(Configuration)" />
</Target>
<Target Name="MoveRazorSdkTools" AfterTargets="PublishRazorSdkTools">
<ItemGroup>
<_RazorToolOutput Include="$(ArtifactsBinDir)Microsoft.NET.Sdk.Razor.Tool\$(Configuration)\$(SdkTargetFramework)\publish\*.*" />
<!-- To reduce the size of the SDK, we use the compiler dependencies that are located in the `Rosyln/bincore` location
instead of shipping our own copies in the Razor compiler. These assemblies will be resolved by path in the
rzc executable. -->
<_RazorToolOutput Remove="$(ArtifactsBinDir)Microsoft.NET.Sdk.Razor.Tool\$(Configuration)\$(SdkTargetFramework)\publish\Microsoft.CodeAnalysis.dll" />
<_RazorToolOutput Remove="$(ArtifactsBinDir)Microsoft.NET.Sdk.Razor.Tool\$(Configuration)\$(SdkTargetFramework)\publish\Microsoft.CodeAnalysis.CSharp.dll" />
<_RazorSourceGeneratorsOutput Include="$(PkgMicrosoft_NET_Sdk_Razor_SourceGenerators_Transport)\source-generators\*" />
</ItemGroup>
<Copy
SourceFiles="@(_RazorToolOutput)"
DestinationFolder="$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk.Razor\tools\"
SkipUnchangedFiles="true" />
<Copy
SourceFiles="@(_RazorSourceGeneratorsOutput)"
DestinationFolder="$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk.Razor\source-generators\"
SkipUnchangedFiles="true" />
</Target>
<Target Name="PublishTargetExtensions"
AfterTargets="Build"
BeforeTargets="GenerateCliRuntimeConfigurationFiles">
<PropertyGroup>
<MSBuildTargetsDirectory>$(OutputPath)runtimes/any/native</MSBuildTargetsDirectory>
</PropertyGroup>
<ItemGroup>
<NuPkgContentForMSBuildExtensions Include="
$(MSBuildTargetsDirectory)/**/*.targets;
$(MSBuildTargetsDirectory)/**/*.props;
$(MSBuildTargetsDirectory)/**/*.overridetasks;
$(MSBuildTargetsDirectory)/**/*.tasks" />
<NuPkgContentForMSBuildExtensionsRelativePaths Include="@(NuPkgContentForMSBuildExtensions->'runtimes/any/native/%(RecursiveDir)%(Filename)%(Extension)')" />
</ItemGroup>
<Copy SourceFiles="@(NuPkgContentForMSBuildExtensions)"
DestinationFiles="@(NuPkgContentForMSBuildExtensions->'$(OutputPath)/%(RecursiveDir)%(Filename)%(Extension)')" />
<RemoveAssetFromDepsPackages DepsFile="$(OutputPath)/$(TargetName).deps.json"
SectionName="runtimeTargets"
AssetPath="%(NuPkgContentForMSBuildExtensionsRelativePaths.Identity)" />
</Target>
<Target Name="PublishSdks"
AfterTargets="Build">
<ItemGroup>
<SdksToBundle Include="targets\RestoreDependency.proj">
<Properties>
NuGetPackageRoot=$(NuGetPackageRoot);
SdkLayoutDirectory=$(OutputPath)/Sdks/%(BundledSdk.Identity);
DependencyPackageName=%(BundledSdk.Identity);
DependencyPackageVersion=%(BundledSdk.Version);
PreviousStageDirectory=$(PreviousStageDirectory)
</Properties>
</SdksToBundle>
</ItemGroup>
<MSBuild
BuildInParallel="False"
Projects="@(SdksToBundle)">
</MSBuild>
<!-- The WPF SDK .nupkg includes some files in the root that we don't want to bundle, so delete them -->
<ItemGroup>
<SDKFilesToDelete Include="$(OutputPath)/Sdks/Microsoft.NET.Sdk.Wpf/*" />
<SDKFilesToDelete Include="$(OutputPath)/Sdks/**/*.nupkg.metadata" />
<SDKFilesToDelete Include="$(OutputPath)/Sdks/**/*.signature.p7s" />
</ItemGroup>
<Delete Files="@(SDKFilesToDelete)" />
</Target>
<Target Name="ChmodPublishDir"
AfterTargets="GenerateCliRuntimeConfigurationFiles"
Condition=" '$(OSName)' != 'win' ">
<Exec Command="find $(OutputPath) -type d -exec chmod 755 {} \;" />
<Exec Command="find $(OutputPath) -type f -exec chmod 644 {} \;" />
</Target>
<Target Name="DeleteSymbolsFromPublishDir"
AfterTargets="GenerateCliRuntimeConfigurationFiles">
<ItemGroup>
<PdbsToDelete Include="$(OutputPath)/**/*.pdb" />
<PdbsToDelete Include="$(OutputPath)/**/*.ni.*.map" />
</ItemGroup>
<Delete Files="@(PdbsToDelete)" />
</Target>
<Target Name="RetargetTools"
BeforeTargets="PublishStage2WithBackwardsCompatibleRuntimes"
AfterTargets="Build">
<PropertyGroup>
<ReplacementPattern>"version": ".*"</ReplacementPattern>
<ReplacementString>"version": "$(MicrosoftNETCoreAppRuntimePackageVersion)"</ReplacementString>
</PropertyGroup>
<ItemGroup>
<!-- Exclude F# from retargeting: https://github.com/dotnet/toolset/issues/2866 -->
<!-- Exclude testhost from retargeting: https://github.com/dotnet/sdk/issues/24769 -->
<ToolRuntimeConfigPath Include="$(OutputPath)/**/*.runtimeconfig.json"
Exclude="$(OutputPath)/**/fsc.runtimeconfig.json;$(OutputPath)/**/fsi.runtimeconfig.json;$(OutputPath)/**/testhost-*.runtimeconfig.json"/>
<MSBuild15Items Include="$(OutputPath)/15.0/**/*" />
</ItemGroup>
<ReplaceFileContents
InputFiles="@(ToolRuntimeConfigPath)"
DestinationFiles="@(ToolRuntimeConfigPath)"
ReplacementPatterns="$(ReplacementPattern)"
ReplacementStrings="$(ReplacementString)" />
<Move
SourceFiles="@(MSBuild15Items)"
DestinationFiles="@(MSBuild15Items -> '$(OutputPath)/Current/%(RecursiveDir)%(Filename)%(Extension)')" />
<RemoveDir Directories="$(OutputPath)/15.0" />
</Target>
<Target Name="GenerateLayout"
DependsOnTargets="PublishVersionFile;
PublishRoslyn;
PublishMSBuildExtensions;
PublishFSharp;
PublishBlazorWasmTools;
PublishStaticWebAssetsTools;
GenerateCliRuntimeConfigurationFiles;
MakeFscRunnableAndMoveToPublishDir;
RemoveFscFilesAfterPublish;
PublishTargetExtensions;
PublishSdks;
ChmodPublishDir;
DeleteSymbolsFromPublishDir;
RetargetTools;
GetDotnetWatchRedistOutputDirectory"
AfterTargets="Build">
<PropertyGroup>
<LayoutDirectory>$(BaseOutputPath)$(Configuration)\layouts\</LayoutDirectory>
<SdkLayoutOutputDirectory>$(LayoutDirectory)$(ArtifactNameSdk)</SdkLayoutOutputDirectory>
<SdkLanguagePackOutputDirectory>$(LayoutDirectory)$(ArtifactNameSdkLanguagePack)</SdkLanguagePackOutputDirectory>
</PropertyGroup>
<ItemGroup>
<ToolsetLayoutInput Include="$(OutputPath)/**/*" />
<ToolsetLanguagePackInput Include="$(OutputPath)/**/*.resources.dll" />
<!--
Include redist outputs published by dotnet-watch.csproj build.
-->
<ToolsetLayoutInput Include="$(DotnetWatchRedistOutputDirectory)/**/*" LayoutSubdirectory="DotnetTools\dotnet-watch\"/>
<ToolsetLanguagePackInput Include="$(DotnetWatchRedistOutputDirectory)/**/*.resources.dll" LayoutSubdirectory="DotnetTools\dotnet-watch\"/>
</ItemGroup>
<!-- Set up Items Defining Layouts for easy change -->
<ItemGroup>
<LayoutDefinition Include="Sdk">
<InputFiles>@(ToolsetLayoutInput)</InputFiles>
<OutputFiles>@(ToolsetLayoutInput -> '$(SdkLayoutOutputDirectory)\%(LayoutSubdirectory)%(RecursiveDir)%(Filename)%(Extension)')</OutputFiles>
</LayoutDefinition>
<LayoutDefinition Include="SdkLanguagePack">
<InputFiles>@(ToolsetLanguagePackInput)</InputFiles>
<OutputFiles>@(ToolsetLanguagePackInput -> '$(SdkLanguagePackOutputDirectory)\%(LayoutSubdirectory)%(RecursiveDir)%(Filename)%(Extension)')</OutputFiles>
</LayoutDefinition>
</ItemGroup>
<Copy SourceFiles="%(LayoutDefinition.InputFiles)"
DestinationFiles="%(LayoutDefinition.OutputFiles)"
SkipUnchangedFiles="true" />
</Target>
</Project>