diff --git a/eng/Signing.props b/eng/Signing.props new file mode 100644 index 000000000..17360d175 --- /dev/null +++ b/eng/Signing.props @@ -0,0 +1,16 @@ + + + + + + + + + + true + + + diff --git a/eng/setbuildinfo.bat b/eng/setbuildinfo.bat index aa620286e..0465d8ab6 100644 --- a/eng/setbuildinfo.bat +++ b/eng/setbuildinfo.bat @@ -27,12 +27,12 @@ IF /I "%Architecture:~0,3%"=="ARM" ( ECHO ##vso[task.setvariable variable=TestParameter] ECHO ##vso[task.setvariable variable=RunTests]false - ECHO ##vso[task.setvariable variable=AdditionalBuildParameters]/p:SignCoreSdk=true /p:DotNetSignType=%SignType% ) ELSE ( ECHO NOT ARM ECHO ##vso[task.setvariable variable=TestParameter]-test ECHO ##vso[task.setvariable variable=RunTests]true - ECHO ##vso[task.setvariable variable=AdditionalBuildParameters]-sign /p:SignCoreSdk=true /p:DotNetSignType=%SignType% -) \ No newline at end of file +) + +ECHO ##vso[task.setvariable variable=AdditionalBuildParameters]-sign /p:DotNetSignType=%SignType% diff --git a/run-build.ps1 b/run-build.ps1 index 6fddefbb0..07db27efd 100644 --- a/run-build.ps1 +++ b/run-build.ps1 @@ -7,15 +7,27 @@ param( [string]$Configuration="Debug", [string]$Architecture="x64", + [switch]$Sign=$false, + [bool]$WarnAsError=$true, [Parameter(ValueFromRemainingArguments=$true)][String[]]$ExtraParameters ) $RepoRoot = "$PSScriptRoot" -$ArchitectureParam="/p:Architecture=$Architecture" -$ConfigurationParam="-configuration $Configuration" +$Parameters = "/p:Architecture=$Architecture" +$Parameters = "$Parameters -configuration $Configuration" + +if ($Sign) { + $Parameters = "$Parameters -sign /p:SignCoreSdk=true" + + # Workaround https://github.com/dotnet/arcade/issues/1776 + $WarnAsError = $false +} + +$Parameters = "$Parameters -WarnAsError `$$WarnAsError" + try { - $ExpressionToInvoke = "$RepoRoot\eng\common\build.ps1 -restore -build $ConfigurationParam $ArchitectureParam $ExtraParameters" + $ExpressionToInvoke = "$RepoRoot\eng\common\build.ps1 -restore -build $Parameters $ExtraParameters" Write-Host "Invoking expression: $ExpressionToInvoke" Invoke-Expression $ExpressionToInvoke } diff --git a/src/redist/targets/GenerateMSIs.targets b/src/redist/targets/GenerateMSIs.targets index 5d3a075a6..82ab2e2e3 100644 --- a/src/redist/targets/GenerateMSIs.targets +++ b/src/redist/targets/GenerateMSIs.targets @@ -20,11 +20,13 @@ $(MSBuildThisFileDirectory)packaging/windows/clisdk/generatenupkg.ps1 $(MSBuildThisFileDirectory)packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.$(Architecture).nuspec - $(ArtifactsShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.$(Architecture).$(FullNugetVersion).nupkg + $(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.$(Architecture).$(FullNugetVersion).nupkg + $(MSBuildThisFileDirectory)/packaging/windows/clisdk/VS.Tools.Net.Core.SDK.$(Architecture).nuspec + $(ArtifactsNonShippingPackagesDir)VS.Tools.Net.Core.SDK.$(Architecture).$(FullNugetVersion).nupkg + $(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.$(FullNugetVersion).nupkg + $(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.swr--> @@ -160,6 +162,21 @@ '$(SdkInstallerNupkgFile)'" /> + + + + + diff --git a/src/redist/targets/packaging/windows/clisdk/Init.cmd b/src/redist/targets/packaging/windows/clisdk/Init.cmd new file mode 100644 index 000000000..b8455ac7f --- /dev/null +++ b/src/redist/targets/packaging/windows/clisdk/Init.cmd @@ -0,0 +1,5 @@ +@echo off + +set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +set DOTNET_MULTILELVEL_LOOKUP=0 +set PATH=%~dp0;%PATH% \ No newline at end of file diff --git a/src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.nuspec b/src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.nuspec index 31f49a45a..7fe19da7c 100644 --- a/src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.nuspec +++ b/src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.nuspec @@ -13,6 +13,6 @@ © Microsoft Corporation. All rights reserved. - + \ No newline at end of file diff --git a/src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.x64.nuspec b/src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.x64.nuspec index 1e5f870e8..088bf6814 100644 --- a/src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.x64.nuspec +++ b/src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.x64.nuspec @@ -13,6 +13,6 @@ © Microsoft Corporation. All rights reserved. - + \ No newline at end of file diff --git a/src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.x86.nuspec b/src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.x86.nuspec index c9b9f73cd..46b995da3 100644 --- a/src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.x86.nuspec +++ b/src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.x86.nuspec @@ -13,6 +13,6 @@ © Microsoft Corporation. All rights reserved. - + \ No newline at end of file diff --git a/src/redist/targets/packaging/windows/clisdk/VS.Tools.Net.Core.SDK.x86.nuspec b/src/redist/targets/packaging/windows/clisdk/VS.Tools.Net.Core.SDK.x86.nuspec new file mode 100644 index 000000000..6a23fb267 --- /dev/null +++ b/src/redist/targets/packaging/windows/clisdk/VS.Tools.Net.Core.SDK.x86.nuspec @@ -0,0 +1,19 @@ + + + + VS.Tools.Net.Core.SDK.x86 + 1.0.0 + VS.Tools.Net.Core.SDK.x86 + Microsoft + Microsoft + https://www.microsoft.com/net/dotnet_library_license.htm + https://github.com/dotnet/cli + true + .Net Core SDK (x86) as a .nupkg for internal VS build consumption + © Microsoft Corporation. All rights reserved. + + + + + + \ No newline at end of file diff --git a/src/redist/targets/packaging/windows/clisdk/_common.ps1 b/src/redist/targets/packaging/windows/clisdk/_common.ps1 deleted file mode 100644 index b2df24187..000000000 --- a/src/redist/targets/packaging/windows/clisdk/_common.ps1 +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. -# - -. $PSScriptRoot\_utility.ps1 - -# Copy things from environment variables that were sent by the build scripts -$Rid = $env:Rid -$Tfm = $env:Tfm -$OutputDir = $env:OutputDir -$Stage1Dir = $env:Stage1Dir -$Stage1CompilationDir = $env:Stage1CompilationDir -$Stage2Dir = $env:Stage2Dir -$Stage2CompilationDir = $env:Stage2CompilationDir -$PackageDir = $env:PackageDir -$TestBinRoot = $env:TestBinRoot -$TestPackageDir = $env:TestPackageDir - -$env:Channel = "$env:RELEASE_SUFFIX" - -# Set reasonable defaults for unset variables -setEnvIfDefault "DOTNET_INSTALL_DIR" "$RepoRoot\.dotnet_stage0\win7-x64" -setEnvIfDefault "DOTNET_CLI_VERSION" "0.1.0.0" -setPathAndHomeIfDefault "$Stage2Dir" -setVarIfDefault "CONFIGURATION" "Debug" diff --git a/src/redist/targets/packaging/windows/clisdk/generatebundle.ps1 b/src/redist/targets/packaging/windows/clisdk/generatebundle.ps1 index cc6e7a46c..0191be48a 100644 --- a/src/redist/targets/packaging/windows/clisdk/generatebundle.ps1 +++ b/src/redist/targets/packaging/windows/clisdk/generatebundle.ps1 @@ -126,6 +126,6 @@ if(!(Test-Path $DotnetBundleOutput)) Exit -1 } -Write-Output -ForegroundColor Green "Successfully created dotnet bundle - $DotnetBundleOutput" +Write-Output "Successfully created dotnet bundle - $DotnetBundleOutput" exit $LastExitCode diff --git a/src/redist/targets/packaging/windows/clisdk/generatenupkg.ps1 b/src/redist/targets/packaging/windows/clisdk/generatenupkg.ps1 index 4ad5aab04..3ccea5ad9 100644 --- a/src/redist/targets/packaging/windows/clisdk/generatenupkg.ps1 +++ b/src/redist/targets/packaging/windows/clisdk/generatenupkg.ps1 @@ -1,9 +1,6 @@ # Copyright (c) .NET Foundation and contributors. All rights reserved. # Licensed under the MIT license. See LICENSE file in the project root for full license information. -# This script is used to generate a nuget package with the windows installer bundle. -# The generated nupkg file is used to deliver the CLI payload to Visual Studio. - param( [Parameter(Mandatory=$true)][string]$SdkBundlePath, [Parameter(Mandatory=$true)][string]$NugetVersion, @@ -11,64 +8,25 @@ param( [Parameter(Mandatory=$true)][string]$NupkgFile ) -. "$PSScriptRoot\_common.ps1" -$RepoRoot = Convert-Path "$PSScriptRoot\..\..\.." -$NuGetDir = Join-Path $RepoRoot ".nuget" +$RepoRoot = Convert-Path "$PSScriptRoot\..\..\..\..\..\.." +$NuGetDir = Join-Path $RepoRoot "artifacts\Tools\nuget" $NuGetExe = Join-Path $NuGetDir "nuget.exe" $OutputDirectory = [System.IO.Path]::GetDirectoryName($NupkgFile) +$SdkBundlePath = [System.IO.Path]::GetFullPath($SdkBundlePath) -function DownloadNugetExe -{ - if (-not (Test-Path $NuGetDir)) - { - New-Item -ItemType Directory -Force -Path $NuGetDir | Out-Null - } - - if (-not (Test-Path $NuGetExe)) { - Write-Output 'Downloading nuget.exe to ' + $NuGetExe - wget https://dist.nuget.org/win-x86-commandline/v4.7.0/nuget.exe -OutFile $NuGetExe - } +if (-not (Test-Path $NuGetDir)) { + New-Item -ItemType Directory -Force -Path $NuGetDir | Out-Null } -function GenerateNupkg -{ - if (-not (Test-Path $NuspecFile)) - { - Write-Output 'Error nuspec not found - $NuspecFile' - } - - $SdkBundlePath = [System.IO.Path]::GetFullPath($SdkBundlePath) - $NuspecFileName = [System.IO.Path]::GetFileName($NuspecFile) - $TempNuspecFile = [System.IO.Path]::Combine($OutputDirectory, $NuspecFileName) - (Get-Content $NuspecFile) -replace '\[DOTNET_BUNDLE\]', $SdkBundlePath | Set-Content $TempNuspecFile - & $NuGetExe pack $TempNuspecFile -Version $NugetVersion -OutputDirectory $OutputDirectory +if (-not (Test-Path $NuGetExe)) { + # Using 3.5.0 to workaround https://github.com/NuGet/Home/issues/5016 + Write-Output "Downloading nuget.exe to $NuGetExe" + wget https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe -OutFile $NuGetExe } - -if(!(Test-Path $SdkBundlePath)) -{ - throw "$SdkBundlePath not found" -} - -Write-Output "Creating nupkg for Sdk installer" - -DownloadNugetExe - -if(Test-Path $NupkgFile) -{ +if (Test-Path $NupkgFile) { Remove-Item -Force $NupkgFile } -if(-Not (GenerateNupkg)) -{ - Exit -1 -} - -if(!(Test-Path $NupkgFile)) -{ - throw "$NupkgFile not generated" -} - -Write-Output -ForegroundColor Green "Successfully created installer nupkg - $NupkgFile" - -exit $LastExitCode +& $NuGetExe pack $NuspecFile -Version $NugetVersion -OutputDirectory $OutputDirectory -NoPackageAnalysis -Properties DOTNET_BUNDLE=$SdkBundlePath +Exit $LastExitCode