diff --git a/eng/pipelines/common/templates/runtimes/run-test-job.yml b/eng/pipelines/common/templates/runtimes/run-test-job.yml
index 6a7978cb8e17e..7ce06791c0e83 100644
--- a/eng/pipelines/common/templates/runtimes/run-test-job.yml
+++ b/eng/pipelines/common/templates/runtimes/run-test-job.yml
@@ -244,7 +244,7 @@ jobs:
# Compose the Core_Root folder containing all artifacts needed for running
# CoreCLR tests. This step also compiles the framework using Crossgen2
# in ReadyToRun jobs.
- - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg)
+ - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg) -ci
displayName: Generate CORE_ROOT
# Build a Mono LLVM AOT cross-compiler for non-amd64 targets (in this case, just arm64)
diff --git a/eng/pipelines/coreclr/exploratory.yml b/eng/pipelines/coreclr/exploratory.yml
index e815ea6260d3c..7b094398a0f3d 100644
--- a/eng/pipelines/coreclr/exploratory.yml
+++ b/eng/pipelines/coreclr/exploratory.yml
@@ -40,7 +40,7 @@ extends:
buildArgs: -s clr+libs -c $(_BuildConfig) -lc Release
timeoutInMinutes: 360
postBuildSteps:
- - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(_BuildConfig) $(archType) $(crossArg) generatelayoutonly
+ - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(_BuildConfig) $(archType) $(crossArg) generatelayoutonly /p:UsePublishedCrossgen2=false
displayName: Create Core_Root
condition: succeeded()
- template: /eng/pipelines/coreclr/templates/jit-exploratory-steps.yml
diff --git a/eng/pipelines/coreclr/templates/crossgen2-comparison-build-job.yml b/eng/pipelines/coreclr/templates/crossgen2-comparison-build-job.yml
index b576e9ceb458c..b335fe7072e69 100644
--- a/eng/pipelines/coreclr/templates/crossgen2-comparison-build-job.yml
+++ b/eng/pipelines/coreclr/templates/crossgen2-comparison-build-job.yml
@@ -98,7 +98,7 @@ jobs:
displayName: 'product build'
# Populate Core_Root
- - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(buildConfig) $(archType) $(crossArg) generatelayoutonly
+ - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(buildConfig) $(archType) $(crossArg) generatelayoutonly /p:UsePublishedCrossgen2=false
displayName: Populate Core_Root
# Create work item directory and populate with assemblies
diff --git a/eng/pipelines/coreclr/templates/crossgen2-comparison-job.yml b/eng/pipelines/coreclr/templates/crossgen2-comparison-job.yml
index 1183d2598a480..c268335145008 100644
--- a/eng/pipelines/coreclr/templates/crossgen2-comparison-job.yml
+++ b/eng/pipelines/coreclr/templates/crossgen2-comparison-job.yml
@@ -94,7 +94,7 @@ jobs:
displayName: 'product build'
# Populate Core_Root
- - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(buildConfig) $(archType) $(crossArg) generatelayoutonly
+ - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(buildConfig) $(archType) $(crossArg) generatelayoutonly /p:UsePublishedCrossgen2=false
displayName: Populate Core_Root
- task: DownloadPipelineArtifact@2
diff --git a/eng/pipelines/coreclr/templates/perf-job.yml b/eng/pipelines/coreclr/templates/perf-job.yml
index 0d3f5b46a7500..3b0c166b2e51d 100644
--- a/eng/pipelines/coreclr/templates/perf-job.yml
+++ b/eng/pipelines/coreclr/templates/perf-job.yml
@@ -273,7 +273,7 @@ jobs:
checkDownloadedFiles: true
# Create Core_Root
- - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(buildConfig) $(archType) generatelayoutonly $(librariesOverrideArg) $(_crossBuildPropertyArg)
+ - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(buildConfig) $(archType) generatelayoutonly $(librariesOverrideArg) $(_crossBuildPropertyArg) /p:UsePublishedCrossgen2=false
displayName: Create Core_Root
condition: and(succeeded(), ne(variables.runtimeFlavorName, 'Mono'), not(in('${{ parameters.runtimeType }}', 'wasm', 'AndroidMono', 'iOSMono', 'iOSNativeAOT')))
diff --git a/eng/pipelines/coreclr/templates/superpmi-collect-job.yml b/eng/pipelines/coreclr/templates/superpmi-collect-job.yml
index 6af16c3db8764..9b3be955c8efc 100644
--- a/eng/pipelines/coreclr/templates/superpmi-collect-job.yml
+++ b/eng/pipelines/coreclr/templates/superpmi-collect-job.yml
@@ -72,6 +72,6 @@ jobs:
displayName: 'generic managed test artifacts'
# Create Core_Root
- - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(buildConfig) $(archType) generatelayoutonly $(librariesOverrideArg)
+ - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(buildConfig) $(archType) generatelayoutonly $(librariesOverrideArg) /p:UsePublishedCrossgen2=false
displayName: Create Core_Root
condition: succeeded()
diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj b/src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj
index aebad93eae08e..25bfcc096d934 100644
--- a/src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj
+++ b/src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj
@@ -37,6 +37,7 @@
+ true
$(CoreCLRILCompilerDir)
$(CoreCLRCrossILCompilerDir)
$(ROOTFS_DIR)
diff --git a/src/coreclr/tools/r2rtest/Crossgen2Runner.cs b/src/coreclr/tools/r2rtest/Crossgen2Runner.cs
index a93532e6382cb..e9024d58da3a0 100644
--- a/src/coreclr/tools/r2rtest/Crossgen2Runner.cs
+++ b/src/coreclr/tools/r2rtest/Crossgen2Runner.cs
@@ -24,15 +24,19 @@ class Crossgen2RunnerOptions
class Crossgen2Runner : CompilerRunner
{
private Crossgen2RunnerOptions Crossgen2RunnerOptions;
- public override CompilerIndex Index => CompilerIndex.CPAOT;
+ private bool IsAssembly => _options.Crossgen2Path != null && _options.Crossgen2Path.FullName.EndsWith(".dll");
- // Crossgen2 runs on top of corerun.
+ // Crossgen2 runs as a standalone binary
protected override string CompilerRelativePath => "";
+ protected override string CompilerFileName => "";
+
+ protected override string CompilerPath => IsAssembly ? _options.DotNetCli : _options.Crossgen2Path?.FullName
+ ?? Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "crossgen2.exe" : "crossgen2");
+
+ public override CompilerIndex Index => CompilerIndex.CPAOT;
- protected override string CompilerFileName => _options.DotNetCli;
- protected readonly List _referenceFiles = new List();
+ protected readonly List _referenceFiles = new();
- private string Crossgen2Path => _options.Crossgen2Path != null ? _options.Crossgen2Path.FullName : Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", "crossgen2.dll");
private bool CompositeMode => Crossgen2RunnerOptions != null ? Crossgen2RunnerOptions.Composite : _options.Composite;
public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2RunnerOptions, IEnumerable references, string overrideOutputPath = null)
@@ -64,7 +68,9 @@ public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2Run
public override ProcessParameters CompilationProcess(string outputFileName, IEnumerable inputAssemblyFileNames)
{
ProcessParameters processParameters = base.CompilationProcess(outputFileName, inputAssemblyFileNames);
- processParameters.Arguments = $"{Crossgen2Path} {processParameters.Arguments}";
+ if (IsAssembly)
+ processParameters.Arguments = $"{_options.Crossgen2Path.FullName} {processParameters.Arguments}";
+
// DOTNET_ variables
processParameters.EnvironmentOverrides["DOTNET_GCStress"] = "";
processParameters.EnvironmentOverrides["DOTNET_HeapVerify"] = "";
@@ -76,6 +82,7 @@ public override ProcessParameters CompilationProcess(string outputFileName, IEnu
processParameters.EnvironmentOverrides["COMPlus_HeapVerify"] = "";
processParameters.EnvironmentOverrides["COMPlus_ReadyToRun"] = "";
processParameters.EnvironmentOverrides["COMPlus_GCName"] = "";
+
return processParameters;
}
diff --git a/src/tests/Common/CLRTest.CrossGen.targets b/src/tests/Common/CLRTest.CrossGen.targets
index cacc3980c1a1d..27bcd1c1ccfc3 100644
--- a/src/tests/Common/CLRTest.CrossGen.targets
+++ b/src/tests/Common/CLRTest.CrossGen.targets
@@ -85,16 +85,17 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
__ResponseFile="$__OutputFile.rsp"
rm $__ResponseFile 2>/dev/null
- __Command=$_DebuggerFullPath
+ __R2RDumpCommand=$_DebuggerFullPath
# Tests run locally need __TestDotNetCmd (set by runtest.py) or a compatible 5.0 dotnet runtime in the path
if [ ! -z ${__TestDotNetCmd+x} ] %3B then
- __Command+=" $__TestDotNetCmd"
+ __R2RDumpCommand+=" $__TestDotNetCmd"
else
- __Command+=" dotnet"
+ __R2RDumpCommand+=" dotnet"
fi
- __R2RDumpCommand=$__Command" $CORE_ROOT/R2RDump/R2RDump.dll"
+ __R2RDumpCommand+=" $CORE_ROOT/R2RDump/R2RDump.dll"
__R2RDumpCommand+=" --header --sc --in $__OutputFile --out $__OutputFile.r2rdump --val"
- __Command+=" $CORE_ROOT/crossgen2/crossgen2.dll"
+
+ __Command="$_DebuggerFullPath $CORE_ROOT/crossgen2/crossgen2"
__Command+=" @$__ResponseFile"
__Command+=" $ExtraCrossGen2Args"
@@ -247,11 +248,10 @@ if defined RunCrossGen2 (
) else (
set __DotNet="dotnet"
)
- set __Command=!_DebuggerFullPath!
- set __Command=!__Command! !__DotNet!
- set __R2RDumpCommand=!__Command! "!CORE_ROOT!\r2rdump\r2rdump.dll"
+ set __R2RDumpCommand=!_DebuggerFullPath! !__DotNet! "!CORE_ROOT!\r2rdump\r2rdump.dll"
set __R2RDumpCommand=!__R2RDumpCommand! --header --sc --in !__OutputFile! --out !__OutputFile!.r2rdump --val
- set __Command=!__Command! "!CORE_ROOT!\crossgen2\crossgen2.dll"
+
+ set __Command=!_DebuggerFullPath! "!CORE_ROOT!\crossgen2\crossgen2.exe"
set __Command=!__Command! @"!__ResponseFile!"
set __Command=!__Command! !ExtraCrossGen2Args!
echo !__InputFile!>>!__ResponseFile!
diff --git a/src/tests/Common/Directory.Build.targets b/src/tests/Common/Directory.Build.targets
index ae168e70984cc..ec1ce62d3ed70 100644
--- a/src/tests/Common/Directory.Build.targets
+++ b/src/tests/Common/Directory.Build.targets
@@ -18,6 +18,7 @@
true
true
+ true
@@ -34,7 +35,47 @@
+ DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">
+
+
+
+
+ <_targetOS>$(TargetOS)
+ <_targetOS Condition="'$(_targetOS)' == 'windows'">win
+ <_apphostPath Condition="Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)
+ <_apphostPath Condition="'$(_apphostPath)' == '' and Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)
+ <_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(ToolsConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(ToolsConfiguration)
+ <_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(LibrariesConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(LibrariesConfiguration)
+
+
+
+
+
+
+
+
+
+
+
@@ -81,7 +122,7 @@
-
+
True
@@ -135,7 +176,7 @@
@@ -223,7 +264,7 @@
- $(__BinDir)\$(BuildArchitecture)
-
$(__TestIntermediatesDir)\crossgen.out
$(DotNetCli)
@@ -680,7 +678,7 @@
$(CrossgenCmd) --crossgen2-parallelism 1
$(CrossgenCmd) --verify-type-and-field-layout
- $(CrossgenCmd) --crossgen2-path "$(CrossgenDir)\crossgen2\tools\crossgen2.dll"
+ $(CrossgenCmd) --crossgen2-path "$(__BinDir)\$(BuildArchitecture)\crossgen2\tools\crossgen2.dll"
diff --git a/src/tests/readytorun/crossboundarylayout/buildcrossgen2image.cmd b/src/tests/readytorun/crossboundarylayout/buildcrossgen2image.cmd
index e75f4808a4d9e..dca44eeb371ab 100644
--- a/src/tests/readytorun/crossboundarylayout/buildcrossgen2image.cmd
+++ b/src/tests/readytorun/crossboundarylayout/buildcrossgen2image.cmd
@@ -48,7 +48,7 @@ goto Loop
if "%COMPOSITENAME%"=="" goto done
-set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll --composite %COMPILEARG%
+set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll --composite %COMPILEARG%
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll.log 2>&1
if NOT EXIST %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\a.dll
@@ -56,28 +56,28 @@ goto done
:CG2Single
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
-set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
+set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done
:CG2NoMethods
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
-set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll --compile-no-methods -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
+set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe --compile-no-methods -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done
:CG2SingleInputBubble
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
-set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
+set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done
:CG2SingleBubbleADOnly
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
-set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\d.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
+set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\d.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done
diff --git a/src/tests/readytorun/determinism/crossgen2determinism.csproj b/src/tests/readytorun/determinism/crossgen2determinism.csproj
index 30f34184583c1..a68f9bae1d47c 100644
--- a/src/tests/readytorun/determinism/crossgen2determinism.csproj
+++ b/src/tests/readytorun/determinism/crossgen2determinism.csproj
@@ -24,16 +24,16 @@
diff --git a/src/tests/readytorun/multifolder/multifolder.csproj b/src/tests/readytorun/multifolder/multifolder.csproj
index 1cf1e99bd976c..071c4158dfe63 100644
--- a/src/tests/readytorun/multifolder/multifolder.csproj
+++ b/src/tests/readytorun/multifolder/multifolder.csproj
@@ -56,13 +56,7 @@ $(CLRTestBatchPreCommands)
set DOTNET_GCName=
set __Command=%_DebuggerFullPath%
- REM Tests run locally need __TestDotNetCmd (set by runtest.py) or a compatible 5.0 dotnet runtime in the path
- if defined __TestDotNetCmd (
- set __Command=!__Command! "!__TestDotNetCmd!"
- ) else (
- set __Command=!__Command! "dotnet"
- )
- set __Command=%__Command% "%CORE_ROOT%\crossgen2\crossgen2.dll"
+ set __Command=%__Command% "%CORE_ROOT%\crossgen2\crossgen2.exe"
set __Command=%__Command% @"%__ResponseFile%"
REM work around problems in 6.0 OSR
@@ -105,14 +99,7 @@ $(CLRTestBashPreCommands)
# Suppress some DOTNET variables for the duration of Crossgen2 execution
export -n DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun DOTNET_TC_OnStackReplacement DOTNET_TC_PartialCompilation
- __Command=$_DebuggerFullPath
- # Tests run locally need __TestDotNetCmd (set by runtest.py) or a compatible 5.0 dotnet runtime in the path
- if [ ! -z ${__TestDotNetCmd+x} ] %3B then
- __Command+=" $__TestDotNetCmd"
- else
- __Command+=" dotnet"
- fi
- __Command+=" $CORE_ROOT/crossgen2/crossgen2.dll"
+ __Command="$_DebuggerFullPath $CORE_ROOT/crossgen2/crossgen2"
__Command+=" @$__ResponseFile"
echo Response file: $__ResponseFile
diff --git a/src/tests/readytorun/tests/mainv1.csproj b/src/tests/readytorun/tests/mainv1.csproj
index dba79aa2d2b35..8b16d14fffd53 100644
--- a/src/tests/readytorun/tests/mainv1.csproj
+++ b/src/tests/readytorun/tests/mainv1.csproj
@@ -44,9 +44,8 @@ if not exist IL_DLLS\mainv1.dll (
echo FAILED to copy mainv1.dll to IL_DLLS
exit /b 1
)
-IF "%__TestDotNetCmd%"=="" set __TestDotNetCmd=dotnet
-%__TestDotNetCmd% %Core_Root%\crossgen2\crossgen2.dll --map -r:%Core_Root%\*.dll -r:%25CD%\IL_DLLS\fieldgetter.dll -r:%25CD%\IL_DLLS\mainv1.dll -o:test.dll testv1\test.dll
+%Core_Root%\crossgen2\crossgen2.exe --map -r:%Core_Root%\*.dll -r:%25CD%\IL_DLLS\fieldgetter.dll -r:%25CD%\IL_DLLS\mainv1.dll -o:test.dll testv1\test.dll
set CrossGenStatus=!ERRORLEVEL!
IF NOT !CrossGenStatus!==0 (
@@ -58,7 +57,7 @@ if not exist test.map (
exit /b 1
)
-%__TestDotNetCmd% %Core_Root%\crossgen2\crossgen2.dll --map -r:%Core_Root%\*.dll -r:%25CD%\IL_DLLS\mainv1.dll -r:testv1\test.dll -o:fieldgetter.dll IL_DLLS\fieldgetter.dll
+%Core_Root%\crossgen2\crossgen2.exe --map -r:%Core_Root%\*.dll -r:%25CD%\IL_DLLS\mainv1.dll -r:testv1\test.dll -o:fieldgetter.dll IL_DLLS\fieldgetter.dll
set CrossGenStatus=!ERRORLEVEL!
IF NOT !CrossGenStatus!==0 (
@@ -70,7 +69,7 @@ if not exist fieldgetter.map (
exit /b 1
)
-%__TestDotNetCmd% %Core_Root%\crossgen2\crossgen2.dll --map -r:%Core_Root%\*.dll -r:%25CD%\IL_DLLS\fieldgetter.dll -r:testv1\test.dll --opt-cross-module:test -o:mainv1.dll IL_DLLS\mainv1.dll
+%Core_Root%\crossgen2\crossgen2.exe --map -r:%Core_Root%\*.dll -r:%25CD%\IL_DLLS\fieldgetter.dll -r:testv1\test.dll --opt-cross-module:test -o:mainv1.dll IL_DLLS\mainv1.dll
set CrossGenStatus=!ERRORLEVEL!
IF NOT !CrossGenStatus!==0 (
@@ -112,7 +111,7 @@ then
exit 1
fi
-$CORE_ROOT/corerun $CORE_ROOT/crossgen2/crossgen2.dll --map -r:$CORE_ROOT/*.dll -r:IL_DLLS/fieldgetter.dll -r:IL_DLLS/mainv1.dll -o:test.dll testv1/test.dll
+"$CORE_ROOT"/crossgen2/crossgen2 --map -r:"$CORE_ROOT"/*.dll -r:IL_DLLS/fieldgetter.dll -r:IL_DLLS/mainv1.dll -o:test.dll testv1/test.dll
__cgExitCode=$?
if [ $__cgExitCode -ne 0 ]
@@ -126,7 +125,7 @@ then
exit 1
fi
-$CORE_ROOT/corerun $CORE_ROOT/crossgen2/crossgen2.dll --map -r:$CORE_ROOT/*.dll -r:testv1/test.dll -r:IL_DLLS/mainv1.dll -o:fieldgetter.dll IL_DLLS/fieldgetter.dll
+"$CORE_ROOT"/crossgen2/crossgen2 --map -r:"$CORE_ROOT"/*.dll -r:testv1/test.dll -r:IL_DLLS/mainv1.dll -o:fieldgetter.dll IL_DLLS/fieldgetter.dll
__cgExitCode=$?
if [ $__cgExitCode -ne 0 ]
@@ -140,7 +139,7 @@ then
exit 1
fi
-$CORE_ROOT/corerun $CORE_ROOT/crossgen2/crossgen2.dll --map -r:$CORE_ROOT/*.dll -r:testv1/test.dll -r:IL_DLLS/fieldgetter.dll --opt-cross-module:test -o:mainv1.dll IL_DLLS/mainv1.dll
+"$CORE_ROOT"/crossgen2/crossgen2 --map -r:"$CORE_ROOT"/*.dll -r:testv1/test.dll -r:IL_DLLS/fieldgetter.dll --opt-cross-module:test -o:mainv1.dll IL_DLLS/mainv1.dll
__cgExitCode=$?
if [ $__cgExitCode -ne 0 ]
diff --git a/src/tests/readytorun/tests/mainv2.csproj b/src/tests/readytorun/tests/mainv2.csproj
index 72e5d816629f0..4345632f63d3c 100644
--- a/src/tests/readytorun/tests/mainv2.csproj
+++ b/src/tests/readytorun/tests/mainv2.csproj
@@ -44,10 +44,8 @@ if not exist IL_DLLS\mainv2.dll (
exit /b 1
)
-IF "%__TestDotNetCmd%"=="" set __TestDotNetCmd=dotnet
-
REM NOTE THAT THIS IS WHERE WE BUILD THE R2R IMAGE using V2 of test not V1
-%__TestDotNetCmd% %Core_Root%\crossgen2\crossgen2.dll --map -r:%Core_Root%\*.dll -r:%25CD%\IL_DLLS\fieldgetter.dll -r:%25CD%\IL_DLLS\mainv2.dll -o:test.dll testv2\test.dll
+%Core_Root%\crossgen2\crossgen2.exe --map -r:%Core_Root%\*.dll -r:%25CD%\IL_DLLS\fieldgetter.dll -r:%25CD%\IL_DLLS\mainv2.dll -o:test.dll testv2\test.dll
set CrossGenStatus=!ERRORLEVEL!
IF NOT !CrossGenStatus!==0 (
@@ -59,7 +57,7 @@ if not exist test.map (
exit /b 1
)
-%__TestDotNetCmd% %Core_Root%\crossgen2\crossgen2.dll --map -r:%Core_Root%\*.dll -r:%25CD%\IL_DLLS\mainv2.dll -r:testv1\test.dll -o:fieldgetter.dll IL_DLLS\fieldgetter.dll
+%Core_Root%\crossgen2\crossgen2.exe --map -r:%Core_Root%\*.dll -r:%25CD%\IL_DLLS\mainv2.dll -r:testv1\test.dll -o:fieldgetter.dll IL_DLLS\fieldgetter.dll
set CrossGenStatus=!ERRORLEVEL!
IF NOT !CrossGenStatus!==0 (
@@ -71,7 +69,7 @@ if not exist fieldgetter.map (
exit /b 1
)
-%__TestDotNetCmd% %Core_Root%\crossgen2\crossgen2.dll --map -r:%Core_Root%\*.dll -r:%25CD%\IL_DLLS\fieldgetter.dll -r:testv1\test.dll --opt-cross-module:test -o:mainv2.dll IL_DLLS\mainv2.dll
+%Core_Root%\crossgen2\crossgen2.exe --map -r:%Core_Root%\*.dll -r:%25CD%\IL_DLLS\fieldgetter.dll -r:testv1\test.dll --opt-cross-module:test -o:mainv2.dll IL_DLLS\mainv2.dll
set CrossGenStatus=!ERRORLEVEL!
IF NOT !CrossGenStatus!==0 (
@@ -114,7 +112,7 @@ then
fi
# NOTE THAT THIS IS WHERE WE BUILD THE R2R IMAGE using V2 of test not V1
-$CORE_ROOT/corerun $CORE_ROOT/crossgen2/crossgen2.dll --map -r:$CORE_ROOT/*.dll -r:IL_DLLS/fieldgetter.dll -r:IL_DLLS/mainv2.dll -o:test.dll testv2/test.dll
+$CORE_ROOT/crossgen2/crossgen2 --map -r:$CORE_ROOT/*.dll -r:IL_DLLS/fieldgetter.dll -r:IL_DLLS/mainv2.dll -o:test.dll testv2/test.dll
__cgExitCode=$?
if [ $__cgExitCode -ne 0 ]
@@ -128,7 +126,7 @@ then
exit 1
fi
-$CORE_ROOT/corerun $CORE_ROOT/crossgen2/crossgen2.dll --map -r:$CORE_ROOT/*.dll -r:testv1/test.dll -r:IL_DLLS/mainv2.dll -o:fieldgetter.dll IL_DLLS/fieldgetter.dll
+$CORE_ROOT/crossgen2/crossgen2 --map -r:$CORE_ROOT/*.dll -r:testv1/test.dll -r:IL_DLLS/mainv2.dll -o:fieldgetter.dll IL_DLLS/fieldgetter.dll
__cgExitCode=$?
if [ $__cgExitCode -ne 0 ]
@@ -142,7 +140,7 @@ then
exit 1
fi
-$CORE_ROOT/corerun $CORE_ROOT/crossgen2/crossgen2.dll --map -r:$CORE_ROOT/*.dll -r:testv1/test.dll -r:IL_DLLS/fieldgetter.dll --opt-cross-module:test -o:mainv2.dll IL_DLLS/mainv2.dll
+$CORE_ROOT/crossgen2/crossgen2 --map -r:$CORE_ROOT/*.dll -r:testv1/test.dll -r:IL_DLLS/fieldgetter.dll --opt-cross-module:test -o:mainv2.dll IL_DLLS/mainv2.dll
__cgExitCode=$?
if [ $__cgExitCode -ne 0 ]