From d0e06b922078e5120c7584278400b15937c95d1c Mon Sep 17 00:00:00 2001 From: Sridhar Periyasamy Date: Wed, 5 Oct 2016 13:53:15 -0700 Subject: [PATCH] Create a nuget package with the windows installers. These nuget packages are used to deliver the CLI payload to Visual Studio setup authoring. They are pushed (by VSO build definitions) into an internal feed consumed by Visual Studio. --- ...Microsoft.DotNet.Cli.Installer.MSI.targets | 19 +++++ .../VS.Redist.Common.Net.Core.SDK.x64.nuspec | 18 +++++ .../VS.Redist.Common.Net.Core.SDK.x86.nuspec | 18 +++++ packaging/windows/clisdk/generatenupkg.ps1 | 74 +++++++++++++++++++ 4 files changed, 129 insertions(+) create mode 100644 packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.x64.nuspec create mode 100644 packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.x86.nuspec create mode 100644 packaging/windows/clisdk/generatenupkg.ps1 diff --git a/build/package/Microsoft.DotNet.Cli.Installer.MSI.targets b/build/package/Microsoft.DotNet.Cli.Installer.MSI.targets index 589b317b2..703690c85 100644 --- a/build/package/Microsoft.DotNet.Cli.Installer.MSI.targets +++ b/build/package/Microsoft.DotNet.Cli.Installer.MSI.targets @@ -18,9 +18,12 @@ $(RepoRoot)/packaging/windows/clisdk/generatemsi.ps1 $(RepoRoot)/packaging/windows/clisdk/generatebundle.ps1 + $(RepoRoot)/packaging/windows/clisdk/generatenupkg.ps1 $(InstallerOutputDirectory)/$(ArtifactNameWithVersionSdk)$(InstallerExtension) $(InstallerOutputDirectory)/$(ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk)$(BundleExtension) + $(RepoRoot)/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.$(Architecture).nuspec + $(InstallerOutputDirectory)/VS.Redist.Common.Net.Core.SDK.$(Architecture).$(NugetVersion).nupkg @@ -113,6 +116,21 @@ '$(Architecture)'" /> + + + + + diff --git a/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.x64.nuspec b/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.x64.nuspec new file mode 100644 index 000000000..2e0701a6d --- /dev/null +++ b/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.x64.nuspec @@ -0,0 +1,18 @@ + + + + VS.Redist.Common.Net.Core.SDK.x64 + 1.0.0 + VS.Redist.Common.Net.Core.SDK.x64 + Microsoft + Microsoft + https://www.microsoft.com/net/dotnet_library_license.htm + https://github.com/dotnet/cli + true + Windows Installers (x64) for .Net Core SDK + © Microsoft Corporation. All rights reserved. + + + + + \ No newline at end of file diff --git a/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.x86.nuspec b/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.x86.nuspec new file mode 100644 index 000000000..aa7055af7 --- /dev/null +++ b/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.x86.nuspec @@ -0,0 +1,18 @@ + + + + VS.Redist.Common.Net.Core.SDK.x86 + 1.0.0 + VS.Redist.Common.Net.Core.SDK.x86 + Microsoft + Microsoft + https://www.microsoft.com/net/dotnet_library_license.htm + https://github.com/dotnet/cli + true + Windows Installer (x86) for .Net Core SDK + © Microsoft Corporation. All rights reserved. + + + + + \ No newline at end of file diff --git a/packaging/windows/clisdk/generatenupkg.ps1 b/packaging/windows/clisdk/generatenupkg.ps1 new file mode 100644 index 000000000..cca52bd7f --- /dev/null +++ b/packaging/windows/clisdk/generatenupkg.ps1 @@ -0,0 +1,74 @@ +# 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, + [Parameter(Mandatory=$true)][string]$NuspecFile, + [Parameter(Mandatory=$true)][string]$NupkgFile +) + +. "$PSScriptRoot\..\..\..\scripts\common\_common.ps1" +$RepoRoot = Convert-Path "$PSScriptRoot\..\..\.." +$NuGetDir = Join-Path $RepoRoot ".nuget" +$NuGetExe = Join-Path $NuGetDir "nuget.exe" +$OutputDirectory = [System.IO.Path]::GetDirectoryName($SdkBundlePath) + +function DownloadNugetExe +{ + if (-not (Test-Path $NuGetDir)) + { + New-Item -ItemType Directory -Force -Path $NuGetDir | Out-Null + } + + if (-not (Test-Path $NuGetExe)) { + Write-Host 'Downloading nuget.exe to ' + $NuGetExe + wget https://dist.nuget.org/win-x86-commandline/v3.5.0-rc1/NuGet.exe -OutFile $NuGetExe + } +} + +function GenerateNupkg +{ + if (-not (Test-Path $NuspecFile)) + { + Write-Host 'Error nuspec not found - $NuspecFile' + } + + $SdkBundleName = [System.IO.Path]::GetFileName($SdkBundlePath) + $NuspecFileName = [System.IO.Path]::GetFileName($NuspecFile) + $TempNuspecFile = [System.IO.Path]::Combine($OutputDirectory, $NuspecFileName) + (Get-Content $NuspecFile) -replace '\[DOTNET_BUNDLE\]', $SdkBundleName | Set-Content $TempNuspecFile + & $NuGetExe pack $TempNuspecFile -Version $NugetVersion -OutputDirectory $OutputDirectory +} + + +if(!(Test-Path $SdkBundlePath)) +{ + throw "$SdkBundlePath not found" +} + +Write-Host "Creating nupkg for Sdk installer" + +DownloadNugetExe + +if(Test-Path $NupkgFile) +{ + Remove-Item -Force $NupkgFile +} + +if(-Not (GenerateNupkg)) +{ + Exit -1 +} + +if(!(Test-Path $NupkgFile)) +{ + throw "$NupkgFile not generated" +} + +Write-Host -ForegroundColor Green "Successfully created installer nupkg - $NupkgFile" + +exit $LastExitCode