@@ -44,6 +44,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
44
44
45
45
<!-- Optimize the framework using the crossgen tool -->
46
46
<CrossgenOutput Condition =" '$(CrossgenOutput)' == '' AND '$(Configuration)' != 'Debug' " >true</CrossgenOutput >
47
+ <UseCrossgen2 >true</UseCrossgen2 >
47
48
48
49
<!-- Produce crossgen profiling symbols (.ni.pdb or .map files). -->
49
50
<GenerateCrossgenProfilingSymbols >true</GenerateCrossgenProfilingSymbols >
@@ -100,13 +101,16 @@ This package is an internal implementation of the .NET Core SDK and is not meant
100
101
<!-- Crossgen executable name -->
101
102
<CrossgenToolFileName >crossgen</CrossgenToolFileName >
102
103
<CrossgenToolFileName Condition =" '$(TargetOsName)' == 'win' " >$(CrossgenToolFileName).exe</CrossgenToolFileName >
104
+ <Crossgen2ToolFileName >crossgen2</Crossgen2ToolFileName >
105
+ <Crossgen2ToolFileName Condition =" '$(TargetOsName)' == 'win' " >$(Crossgen2ToolFileName).exe</Crossgen2ToolFileName >
103
106
<!-- Default crossgen executable relative path -->
104
107
<CrossgenToolPackagePath >$(CrossgenToolFileName)</CrossgenToolPackagePath >
105
108
<!-- Disambiguated RID-specific crossgen executable relative path -->
106
109
<CrossgenToolPackagePath Condition =" '$(CrossCompileDirectory)' != '' " >$(CrossCompileDirectory)\$(CrossgenToolPackagePath)</CrossgenToolPackagePath >
107
110
108
111
<!-- E.g. "PkgMicrosoft_NETCore_App_Runtime_win-x64" (set in obj/Microsoft.AspNetCore.App.Runtime.csproj.nuget.g.props). -->
109
112
<RuntimePackageRootVariableName >PkgMicrosoft_NETCore_App_Runtime_$(RuntimeIdentifier)</RuntimePackageRootVariableName >
113
+ <Crossgen2PackageRootVariableName >PkgMicrosoft_NETCore_App_Crossgen2_$(TargetOsName)-$(BuildArchitecture)</Crossgen2PackageRootVariableName >
110
114
111
115
<AssetTargetFallback >$(AssetTargetFallback);native,Version=0.0</AssetTargetFallback >
112
116
@@ -125,6 +129,11 @@ This package is an internal implementation of the .NET Core SDK and is not meant
125
129
PrivateAssets =" All"
126
130
GeneratePathProperty =" true" />
127
131
132
+ <Reference Include =" Microsoft.NETCore.App.Crossgen2.$(TargetOsName)-$(BuildArchitecture)"
133
+ ExcludeAssets =" All"
134
+ PrivateAssets =" All"
135
+ GeneratePathProperty =" true" />
136
+
128
137
<ProjectReference Condition =" '$(BuildIisNativeProjects)' == 'true' AND $(BuildNative) "
129
138
Include =" $(RepoRoot)src\Servers\IIS\AspNetCoreModuleV2\InProcessRequestHandler\InProcessRequestHandler.vcxproj" >
130
139
<SetPlatform >Platform=$(NativePlatform)</SetPlatform >
@@ -349,10 +358,16 @@ This package is an internal implementation of the .NET Core SDK and is not meant
349
358
<RuntimePackageRootMapping >
350
359
<RuntimePackageRoot >$(%(Identity))</RuntimePackageRoot >
351
360
</RuntimePackageRootMapping >
361
+ <Crossgen2PackageRootMapping Include =" $(Crossgen2PackageRootVariableName)" />
362
+ <Crossgen2PackageRootMapping >
363
+ <Crossgen2PackageRoot >$(%(Identity))</Crossgen2PackageRoot >
364
+ </Crossgen2PackageRootMapping >
352
365
</ItemGroup >
353
366
<PropertyGroup >
354
367
<RuntimePackageRoot >@(RuntimePackageRootMapping->'%(RuntimePackageRoot)')</RuntimePackageRoot >
355
368
<RuntimePackageRoot >$([MSBuild]::EnsureTrailingSlash('$(RuntimePackageRoot)'))</RuntimePackageRoot >
369
+ <Crossgen2PackageRoot >@(Crossgen2PackageRootMapping->'%(Crossgen2PackageRoot)')</Crossgen2PackageRoot >
370
+ <Crossgen2PackageRoot >$([MSBuild]::EnsureTrailingSlash('$(Crossgen2PackageRoot)'))</Crossgen2PackageRoot >
356
371
</PropertyGroup >
357
372
</Target >
358
373
@@ -375,10 +390,18 @@ This package is an internal implementation of the .NET Core SDK and is not meant
375
390
376
391
<ReferenceCopyLocalPaths Remove =" @(IntermediateCrossgenAssembly)" />
377
392
<ReferenceCopyLocalPaths Include =" @(IntermediateCrossgenAssembly->'$(TargetDir)%(FileName)%(Extension)')" />
393
+
394
+ <_DistinctPlatformAssemblyPaths Include =" @(_PlatformAssemblyPaths->Distinct())" />
395
+ <_DistinctPlatformAssemblyPaths >
396
+ <CommandLineOption >-r:%(Identity)*.dll</CommandLineOption >
397
+ </_DistinctPlatformAssemblyPaths >
398
+
399
+ <Crossgen2PlatformAssemblyPaths Include =" @(_DistinctPlatformAssemblyPaths->'%(CommandLineOption)')" />
378
400
</ItemGroup >
379
401
380
402
<PropertyGroup >
381
- <CrossgenToolPath >$([System.IO.Path]::Combine('$(RuntimePackageRoot)', 'tools', '$(CrossgenToolPackagePath)'))</CrossgenToolPath >
403
+ <CrossgenToolPath Condition =" '$(UseCrossgen2)' != 'true'" >$([System.IO.Path]::Combine('$(RuntimePackageRoot)', 'tools', '$(CrossgenToolPackagePath)'))</CrossgenToolPath >
404
+ <CrossgenToolPath Condition =" '$(UseCrossgen2)' == 'true'" >$([System.IO.Path]::Combine('$(Crossgen2PackageRoot)', 'tools', '$(Crossgen2ToolFileName)'))</CrossgenToolPath >
382
405
<CrossgenSymbolsTargetDir >$(TargetDir)</CrossgenSymbolsTargetDir >
383
406
<CrossgenPlatformAssemblyPaths >@(_PlatformAssemblyPaths->Distinct(), '$(PathSeparator)')</CrossgenPlatformAssemblyPaths >
384
407
@@ -392,15 +415,21 @@ This package is an internal implementation of the .NET Core SDK and is not meant
392
415
File =" $(CrossgenToolDir)PlatformAssembliesPaths.rsp"
393
416
Overwrite =" true" />
394
417
418
+ <WriteLinesToFile
419
+ Lines =" @(Crossgen2PlatformAssemblyPaths)"
420
+ File =" $(CrossgenToolDir)PlatformAssembliesPathsCrossgen2.rsp"
421
+ Overwrite =" true" />
422
+
395
423
<ItemGroup >
396
424
<RuntimePackageFiles Include =" $(RuntimePackageRoot)runtimes\**\*" />
397
425
</ItemGroup >
398
426
399
427
<Error Text =" Could not find crossgen $(CrossgenToolPath)" Condition =" ! Exists($(CrossgenToolPath))" />
400
428
401
429
<!-- Create tool directory with crossgen executable and runtime assemblies -->
402
- <Copy SourceFiles =" @(RuntimePackageFiles);$(CrossgenToolPath)" DestinationFolder =" $(CrossGenToolDir)" />
403
- <Exec Command =" chmod +x " $(CrossGenToolDir)$(CrossgenToolFileName)" " Condition =" '$(OS)' != 'Windows_NT'" />
430
+ <Copy SourceFiles =" @(RuntimePackageFiles)" DestinationFolder =" $(CrossGenToolDir)" />
431
+ <Copy Condition =" '$(UseCrossgen2)' != 'true'" SourceFiles =" $(CrossgenToolPath)" DestinationFolder =" $(CrossGenToolDir)" />
432
+ <Exec Command =" chmod +x " $(CrossGenToolDir)$(CrossgenToolFileName)" " Condition =" '$(OS)' != 'Windows_NT' and '$(UseCrossgen2)' != 'true'" />
404
433
</Target >
405
434
406
435
<Target Name =" _BatchCrossGenAssemblies"
@@ -413,18 +442,34 @@ This package is an internal implementation of the .NET Core SDK and is not meant
413
442
Condition =" '$(CrossCompileDirectory)' == ''" >$(RuntimePackageRoot)runtimes\$(RuntimeIdentifier)\native\$(LibPrefix)clrjit$(LibExtension)</CoreCLRJitPath >
414
443
<CoreCLRJitPath
415
444
Condition =" '$(CrossCompileDirectory)' != ''" >$(RuntimePackageRoot)runtimes\$(CrossCompileDirectory)\native\$(LibPrefix)clrjit$(LibExtension)</CoreCLRJitPath >
445
+
446
+ <Crossgen2TargetOs >$(TargetOsName)</Crossgen2TargetOs >
447
+ <Crossgen2TargetOs Condition =" '$(TargetOsName)' == 'win'" >windows</Crossgen2TargetOs >
448
+ <Crossgen2Args >--targetarch:$(TargetArchitecture)</Crossgen2Args >
449
+ <Crossgen2Args >$(Crossgen2Args) --targetos:$(Crossgen2TargetOs)</Crossgen2Args >
450
+ <Crossgen2Args >$(Crossgen2Args) -O</Crossgen2Args >
451
+ <Crossgen2Args >$(Crossgen2Args) @" $(CrossgenToolDir)PlatformAssembliesPathsCrossgen2.rsp" </Crossgen2Args >
452
+ <Crossgen2Args Condition =" '$(GenerateCrossgenProfilingSymbols)' == 'true' and '$(TargetOsName)' == 'win'" >$(Crossgen2Args) --pdb --pdb-path:" $(CrossgenSymbolsTargetDir)" </Crossgen2Args >
453
+ <Crossgen2Args Condition =" '$(GenerateCrossgenProfilingSymbols)' == 'true' and '$(TargetOsName)' != 'win'" >$(Crossgen2Args) --perfmap --perfmap-path:" $(CrossgenSymbolsTargetDir)" </Crossgen2Args >
416
454
</PropertyGroup >
417
455
418
- <Exec Command =" " $(CrossgenToolDir)$(CrossgenToolFileName)" -nologo -readytorun -in " %(IntermediateCrossgenAssembly.Identity)" -out " $(TargetDir)%(FileName)%(Extension)" -jitpath " $(CoreCLRJitPath)" " @$(CrossgenToolDir)PlatformAssembliesPaths.rsp" "
456
+ <Exec Condition =" '$(UseCrossgen2)' != 'true'"
457
+ Command =" " $(CrossgenToolDir)$(CrossgenToolFileName)" -nologo -readytorun -in " %(IntermediateCrossgenAssembly.Identity)" -out " $(TargetDir)%(FileName)%(Extension)" -jitpath " $(CoreCLRJitPath)" " @$(CrossgenToolDir)PlatformAssembliesPaths.rsp" "
419
458
EnvironmentVariables =" COMPlus_PartialNGen=0"
420
459
IgnoreStandardErrorWarningFormat =" true"
421
460
StandardOutputImportance =" High" />
422
461
423
- <Exec Condition =" '$(GenerateCrossgenProfilingSymbols)' == 'true' "
462
+ <Exec Condition =" '$(GenerateCrossgenProfilingSymbols)' == 'true' and '$(UseCrossgen2)' != 'true' "
424
463
Command =" " $(CrossgenToolDir)$(CrossgenToolFileName)" -nologo -readytorun -in " $(TargetDir)%(IntermediateCrossgenAssembly.FileName)%(Extension)" -Create$(CrossGenSymbolsType) " $(CrossgenSymbolsTargetDir)" " @$(CrossgenToolDir)PlatformAssembliesPaths.rsp" "
425
464
EnvironmentVariables =" COMPlus_PartialNGen=0"
426
465
IgnoreStandardErrorWarningFormat =" true"
427
466
StandardOutputImportance =" High" />
467
+
468
+ <Exec Condition =" '$(UseCrossgen2)' == 'true'"
469
+ Command =" " $(CrossgenToolPath)" $(Crossgen2Args) -o:" $(TargetDir)%(FileName)%(Extension)" " %(IntermediateCrossgenAssembly.Identity)" "
470
+ IgnoreStandardErrorWarningFormat =" true"
471
+ StandardOutputImportance =" High" />
472
+
428
473
</Target >
429
474
430
475
<!--
0 commit comments