REM don't precompile anything from CoreCLR
if /I exist %CORE_ROOT_STAGE%\%2 exit /b 0
-"%CORE_ROOT_STAGE%\crossgen.exe" /Platform_Assemblies_Paths "%CORE_ROOT%" "%1" >nul 2>nul
+"%CORE_ROOT_STAGE%\crossgen.exe" /Platform_Assemblies_Paths "%CORE_ROOT%" /in "%1" /out "%CORE_ROOT%/temp.ni.dll" >nul 2>nul
set /a __exitCode = %errorlevel%
if "%__exitCode%" == "-2146230517" (
echo %2 is not a managed assembly.
echo Unable to precompile %2
exit /b 0
)
+
+:: Delete original .dll & replace it with the Crossgened .dll
+del %1
+ren "%CORE_ROOT%\temp.ni.dll" %2
echo Successfully precompiled %2
exit /b 0
<WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) do%0a</WrapperShContents>
<WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) filename=%24{fileToPrecompile}%0a</WrapperShContents>
<WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) echo Precompiling %24filename%0a</WrapperShContents>
- <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) %24overlayDir/crossgen /Platform_Assemblies_Paths %24overlayDir %24filename 1> %24filename.stdout 2>%24filename.stderr%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) %24overlayDir/crossgen /Platform_Assemblies_Paths %24overlayDir /in %24filename /out %24overlayDir/temp.ni.dll 1> %24filename.stdout 2>%24filename.stderr%0a</WrapperShContents>
<WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) exitCode=%24%3F%0a</WrapperShContents>
<WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) if [ %24exitCode != 0 ]%3B then%0a</WrapperShContents>
<WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) if grep -q -e '(COR_E_ASSEMBLYEXPECTED)' %24filename.stderr%3B then%0a</WrapperShContents>
<WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) else%0a</WrapperShContents>
<WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) echo Unable to precompile %24filename.%0a</WrapperShContents>
<WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) fi%0a</WrapperShContents>
- <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) fi%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) else%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) rm %24filename%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) mv %24overlayDir/temp.ni.dll %24filename%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) fi%0a</WrapperShContents>
<WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) rm %24filename.stdout%0a</WrapperShContents>
<WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) rm %24filename.stderr%0a</WrapperShContents>
<WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) done%0a</WrapperShContents>