diff --git a/build.cmd b/build.cmd
index bd617d268a9d..e72f257652e7 100644
--- a/build.cmd
+++ b/build.cmd
@@ -3,5 +3,5 @@
REM Copyright (c) .NET Foundation and contributors. All rights reserved.
REM Licensed under the MIT license. See LICENSE file in the project root for full license information.
-powershell -NoProfile -NoLogo -Command "%~dp0build_projects\dotnet-cli-build\build.ps1 %*; exit $LastExitCode;"
+powershell -NoProfile -NoLogo -Command "%~dp0build.ps1 %*; exit $LastExitCode;"
if %errorlevel% neq 0 exit /b %errorlevel%
diff --git a/build.proj b/build.proj
index 3935e56a4bb6..3308804e34cd 100644
--- a/build.proj
+++ b/build.proj
@@ -30,6 +30,13 @@
1.0.2
1.0.2
+
+ $(RepoRoot)/.dotnet_stage0/Windows/$(Architecture)
+ $(RepoRoot)/.dotnet_stage0/Darwin
+ $(RepoRoot)/.dotnet_stage0/Linux
+ .exe
+
+ $(Stage0Path)/dotnet$(ExeExtension)
@@ -48,7 +55,13 @@
Inputs="@(DotnetCliBuildFrameworkInputs)"
Outputs="$(CLIBuildDll)"
DependsOnTargets="MSBuildWorkaroundTarget">
-
+
+ $(MSBuildThisFileDirectory)/build_projects/dotnet-cli-build
+
+
+
+
+
diff --git a/build.sh b/build.sh
index ae1cde3433a3..563e5176be8d 100755
--- a/build.sh
+++ b/build.sh
@@ -49,12 +49,12 @@ args=($temp)
dockerbuild()
{
- BUILD_COMMAND=/opt/code/build_projects/dotnet-cli-build/build.sh $DIR/scripts/dockerrun.sh --non-interactive "$@"
+ BUILD_COMMAND=/opt/code/run_build.sh $DIR/scripts/dockerrun.sh --non-interactive "$@"
}
# Check if we need to build in docker
if [ ! -z "$BUILD_IN_DOCKER" ]; then
dockerbuild "${args[@]}"
else
- $DIR/build_projects/dotnet-cli-build/build.sh "${args[@]}"
+ $DIR/run_build.sh "${args[@]}"
fi
diff --git a/build/Microsoft.DotNet.Cli.Compile.targets b/build/Microsoft.DotNet.Cli.Compile.targets
index 919c0a05758e..cad96f8b5e24 100644
--- a/build/Microsoft.DotNet.Cli.Compile.targets
+++ b/build/Microsoft.DotNet.Cli.Compile.targets
@@ -27,7 +27,7 @@
@(CompileStageInputs)
$(Stage1Directory)
$(Stage1SymbolsDirectory)
- $(Stage0Path)/dotnet$(ExeExtension)
+ $(DotnetStage0)
@(CompileStageInputs)
diff --git a/build/Microsoft.DotNet.Cli.Prepare.targets b/build/Microsoft.DotNet.Cli.Prepare.targets
index e4da334aa15c..6faaa3216cc7 100644
--- a/build/Microsoft.DotNet.Cli.Prepare.targets
+++ b/build/Microsoft.DotNet.Cli.Prepare.targets
@@ -22,12 +22,7 @@
-
- $(RepoRoot)/.dotnet_stage0/Windows/$(Architecture)
- $(RepoRoot)/.dotnet_stage0/Darwin
- $(RepoRoot)/.dotnet_stage0/Linux
- .exe
-
+
$(Stage0Path)
$(RepoRoot)/artifacts/$(Rid)
diff --git a/build_projects/dotnet-cli-build/build.ps1 b/run_build.ps1
similarity index 66%
rename from build_projects/dotnet-cli-build/build.ps1
rename to run_build.ps1
index bbc5dde50695..1a6ba2a33703 100644
--- a/build_projects/dotnet-cli-build/build.ps1
+++ b/run_build.ps1
@@ -5,28 +5,24 @@
param(
[string]$Configuration="Debug",
- [string[]]$Targets=@("Default"),
[string]$Architecture="x64",
[switch]$NoPackage,
- [switch]$NoRun,
[switch]$Help)
if($Help)
{
- Write-Host "Usage: .\build.ps1 [-Configuration ] [-Targets ] [-Architecture ] [-NoPackage] [-Help]"
+ Write-Host "Usage: .\build.ps1 [-Configuration ] [-Architecture ] [-NoPackage] [-Help]"
Write-Host ""
Write-Host "Options:"
Write-Host " -Configuration Build the specified Configuration (Debug or Release, default: Debug)"
- Write-Host " -Targets Comma separated build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)"
Write-Host " -Architecture Build the specified architecture (x64 or x86 (supported only on Windows), default: x64)"
Write-Host " -NoPackage Skip packaging targets"
- Write-Host " -NoRun Skip running the build"
Write-Host " -Help Display this help message"
exit 0
}
$env:CONFIGURATION = $Configuration;
-$RepoRoot = "$PSScriptRoot\..\.."
+$RepoRoot = "$PSScriptRoot"
$env:NUGET_PACKAGES = "$RepoRoot\.nuget\packages"
if($NoPackage)
@@ -69,23 +65,5 @@ $env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
# Disable first run since we want to control all package sources
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
-# Restore the build scripts
-Write-Host "Restoring Build Script projects..."
-pushd "$PSScriptRoot"
-dotnet restore
-if($LASTEXITCODE -ne 0) { throw "Failed to restore" }
-popd
-
-# Publish the builder
-Write-Host "Compiling Build Scripts..."
-dotnet publish "$PSScriptRoot" -o "$PSScriptRoot\bin" --framework netcoreapp1.0
-if($LASTEXITCODE -ne 0) { throw "Failed to compile build scripts" }
-
-if(!$NoRun)
-{
- # Run the builder
- Write-Host "Invoking Build Scripts..."
- Write-Host " Configuration: $env:CONFIGURATION"
- & "$PSScriptRoot\bin\dotnet-cli-build.exe" @Targets
- if($LASTEXITCODE -ne 0) { throw "Build failed" }
-}
+dotnet build3 build.proj /p:Architecture=x64
+if($LASTEXITCODE -ne 0) { throw "Failed to restore" }
diff --git a/build_projects/dotnet-cli-build/build.sh b/run_build.sh
old mode 100755
new mode 100644
similarity index 80%
rename from build_projects/dotnet-cli-build/build.sh
rename to run_build.sh
index 11fee896ceb4..5f8c1e9841f2
--- a/build_projects/dotnet-cli-build/build.sh
+++ b/run_build.sh
@@ -25,16 +25,9 @@ while [[ $# > 0 ]]; do
export CONFIGURATION=$2
shift
;;
- --targets)
- IFS=',' read -r -a targets <<< $2
- shift
- ;;
--nopackage)
export DOTNET_BUILD_SKIP_PACKAGING=1
;;
- --norun)
- export DOTNET_BUILD_SKIP_RUN=1
- ;;
--skip-prereqs)
# Allow CI to disable prereqs check since the CI has the pre-reqs but not ldconfig it seems
export DOTNET_INSTALL_SKIP_PREREQS=1
@@ -44,10 +37,8 @@ while [[ $# > 0 ]]; do
echo ""
echo "Options:"
echo " --configuration Build the specified Configuration (Debug or Release, default: Debug)"
- echo " --targets Comma separated build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)"
echo " --skip-prereqs Skip checks for pre-reqs in dotnet_install"
echo " --nopackage Skip packaging targets"
- echo " --norun Skip running the build"
echo " --docker Build in Docker using the Dockerfile located in scripts/docker/IMAGENAME"
echo " --help Display this help message"
exit 0
@@ -107,23 +98,4 @@ fi
# Disable first run since we want to control all package sources
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
-# Restore the build scripts
-echo "Restoring Build Script projects..."
-(
- cd "$DIR"
- dotnet restore
-)
-
-# Build the builder
-echo "Compiling Build Scripts..."
-dotnet publish "$DIR" -o "$DIR/bin" --framework netcoreapp1.0
-
-if [ -z "$DOTNET_BUILD_SKIP_RUN" ]; then
- export PATH="$OLDPATH"
- # Run the builder
- echo "Invoking Build Scripts..."
- echo "Configuration: $CONFIGURATION"
-
- $DIR/bin/dotnet-cli-build ${targets[@]}
-fi
-exit $?
+dotnet build3 build.proj /p:Architecture=x64
\ No newline at end of file