I often fall into a build failure like the following when passing /clean
E:\Github\coreclr\tests\runtest.proj : error MSB4057: The target "rebuild"
does not exist in the project.
runtest.proj is actually invoked in two places one from a part of
build.cmd targeting CreateTestOverlay only, and the other from
runtest.cmd, which creates wrapper and actually running the tests.
So, definining "rebuild" target that does "clean" and "build" doesn't
solve this problem.
The fix is to not target "rebuild" in the former case since we are
explicitly targeting "CreateTestOverlay" only. Instead of putting "/t:rebuild"
in the common msbuild argument, I added it to each instance except this case.
Commit migrated from https://github.com/dotnet/coreclr/commit/
06f6edeffcae1905cc77a130c7bc916188eba1c7
:: The issue is that we extend the build with our own targets which
:: means that that rebuilding cannot successfully delete the task
:: assembly.
-set __msbuildCommonArgs=/nologo /nodeReuse:false %__msbuildCleanBuildArgs% %__msbuildExtraArgs%
+set __msbuildCommonArgs=/nologo /nodeReuse:false %__msbuildExtraArgs%
if not defined __BuildSequential (
set __msbuildCommonArgs=%__msbuildCommonArgs% /maxcpucount
)
set __BuildLogRootName=Tests_Native
-call :msbuild "%__NativeTestIntermediatesDir%\install.vcxproj" /p:Configuration=%__BuildType% /p:Platform=%__BuildArch%
+call :msbuild "%__NativeTestIntermediatesDir%\install.vcxproj" %__msbuildCleanBuildArgs% /p:Configuration=%__BuildType% /p:Platform=%__BuildArch%
if errorlevel 1 exit /b 1
REM endlocal to rid us of environment changes from vcvarsall.bat
exit /b 1
)
-set __msbuildManagedBuildArgs=
+set __msbuildManagedBuildArgs=%__msbuildCleanBuildArgs%
if defined __crossgen (
echo Building tests with CrossGen enabled.