From ccef10b70c7426c8aa9685bbcfbe5e24008bf638 Mon Sep 17 00:00:00 2001 From: Sridhar Periyasamy Date: Thu, 24 Mar 2016 18:05:14 -0700 Subject: [PATCH 1/2] Windows Installer changes - Make CLI SDK MSI non-upgradable. It must alwasy be installed SxS. - The CLI bundle and SharedFx bundle are non-upgradeable.They are also installed SxS. - Make host\muxer upgradeable. It will be upgradeable till v1.0.0 RTM. Post RTM will be installed SxS with v.1.0.0. - SharedFx MSI was using the CLI MSI version. Fixing it to use the SharedFx version. - Do not allow bundles to uninstall. User will be able to uninstall the individual MSIs. --- packaging/windows/clisdk/bundle.wxs | 12 +++++++----- packaging/windows/clisdk/generatebundle.ps1 | 2 ++ packaging/windows/clisdk/generatemsi.ps1 | 2 ++ packaging/windows/clisdk/variables.wxi | 2 -- scripts/dotnet-cli-build/MsiTargets.cs | 15 ++++++++++----- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/packaging/windows/clisdk/bundle.wxs b/packaging/windows/clisdk/bundle.wxs index 7b9091c66..2c1f17fe1 100644 --- a/packaging/windows/clisdk/bundle.wxs +++ b/packaging/windows/clisdk/bundle.wxs @@ -6,9 +6,11 @@ + Compressed="yes" + DisableModify="yes" + DisableRemove="yes"> - + - + - + diff --git a/packaging/windows/clisdk/generatebundle.ps1 b/packaging/windows/clisdk/generatebundle.ps1 index 2a949962d..69fd1534e 100644 --- a/packaging/windows/clisdk/generatebundle.ps1 +++ b/packaging/windows/clisdk/generatebundle.ps1 @@ -9,6 +9,7 @@ param( [Parameter(Mandatory=$true)][string]$WixRoot, [Parameter(Mandatory=$true)][string]$DotnetMSIVersion, [Parameter(Mandatory=$true)][string]$DotnetCLIVersion, + [Parameter(Mandatory=$true)][string]$UpgradeCode, [Parameter(Mandatory=$true)][string]$Architecture, [Parameter(Mandatory=$true)][string]$ReleaseSuffix ) @@ -31,6 +32,7 @@ function RunCandleForBundle -dDisplayVersion="$DotnetCLIVersion" ` -dReleaseSuffix="$ReleaseSuffix" ` -dCLISDKMsiSourcePath="$CLISDKMSIFile" ` + -dUpgradeCode="$UpgradeCode" ` -dSharedFXMsiSourcePath="$SharedFxMSIFile" ` -dSharedHostMsiSourcePath="$SharedHostMSIFile" ` -arch "$Architecture" ` diff --git a/packaging/windows/clisdk/generatemsi.ps1 b/packaging/windows/clisdk/generatemsi.ps1 index 5631e1f94..ed1e7a807 100644 --- a/packaging/windows/clisdk/generatemsi.ps1 +++ b/packaging/windows/clisdk/generatemsi.ps1 @@ -7,6 +7,7 @@ param( [Parameter(Mandatory=$true)][string]$WixRoot, [Parameter(Mandatory=$true)][string]$DotnetMSIVersion, [Parameter(Mandatory=$true)][string]$DotnetCLIVersion, + [Parameter(Mandatory=$true)][string]$UpgradeCode, [Parameter(Mandatory=$true)][string]$Architecture, [Parameter(Mandatory=$true)][string]$ReleaseSuffix ) @@ -49,6 +50,7 @@ function RunCandle -dMicrosoftEula="$RepoRoot\packaging\osx\resources\en.lproj\eula.rtf" ` -dBuildVersion="$DotnetMSIVersion" ` -dDisplayVersion="$DotnetCLIVersion" ` + -dUpgradeCode="$UpgradeCode" ` -dReleaseSuffix="$ReleaseSuffix" ` -arch "$Architecture" ` -ext WixDependencyExtension.dll ` diff --git a/packaging/windows/clisdk/variables.wxi b/packaging/windows/clisdk/variables.wxi index d5affc10a..48623d872 100644 --- a/packaging/windows/clisdk/variables.wxi +++ b/packaging/windows/clisdk/variables.wxi @@ -26,11 +26,9 @@ - - diff --git a/scripts/dotnet-cli-build/MsiTargets.cs b/scripts/dotnet-cli-build/MsiTargets.cs index 3ad834265..f71e868b0 100644 --- a/scripts/dotnet-cli-build/MsiTargets.cs +++ b/scripts/dotnet-cli-build/MsiTargets.cs @@ -107,9 +107,11 @@ namespace Microsoft.DotNet.Cli.Build public static BuildTargetResult GenerateCliSdkMsi(BuildTargetContext c) { var cliSdkRoot = c.BuildContext.Get("CLISDKRoot"); + var upgradeCode = Utils.GenerateGuidFromName(SdkMsi).ToString().ToUpper(); + Cmd("powershell", "-NoProfile", "-NoLogo", Path.Combine(Dirs.RepoRoot, "packaging", "windows", "clisdk", "generatemsi.ps1"), - cliSdkRoot, SdkMsi, WixRoot, MsiVersion, CliVersion, Arch, Channel) + cliSdkRoot, SdkMsi, WixRoot, MsiVersion, CliVersion, upgradeCode, Arch, Channel) .Execute() .EnsureSuccessful(); return c.Success(); @@ -143,7 +145,8 @@ namespace Microsoft.DotNet.Cli.Build var inputDir = c.BuildContext.Get("SharedFrameworkPublishRoot"); var sharedFrameworkNuGetName = Monikers.SharedFrameworkName; var sharedFrameworkNuGetVersion = c.BuildContext.Get("SharedFrameworkNugetVersion"); - var upgradeCode = Utils.GenerateGuidFromName($"{sharedFrameworkNuGetName}-{sharedFrameworkNuGetVersion}-{Arch}").ToString().ToUpper(); + var msiVerison = sharedFrameworkNuGetVersion.Split('-')[0]; + var upgradeCode = Utils.GenerateGuidFromName(SharedFrameworkMsi).ToString().ToUpper(); var wixObjRoot = Path.Combine(Dirs.Output, "obj", "wix", "sharedframework"); if (Directory.Exists(wixObjRoot)) @@ -154,7 +157,7 @@ namespace Microsoft.DotNet.Cli.Build Cmd("powershell", "-NoProfile", "-NoLogo", Path.Combine(Dirs.RepoRoot, "packaging", "windows", "sharedframework", "generatemsi.ps1"), - inputDir, SharedFrameworkMsi, WixRoot, MsiVersion, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, Arch, wixObjRoot) + inputDir, SharedFrameworkMsi, WixRoot, msiVerison, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, Arch, wixObjRoot) .Execute() .EnsureSuccessful(); return c.Success(); @@ -165,9 +168,11 @@ namespace Microsoft.DotNet.Cli.Build [BuildPlatforms(BuildPlatform.Windows)] public static BuildTargetResult GenerateCliSdkBundle(BuildTargetContext c) { + var upgradeCode = Utils.GenerateGuidFromName(SdkBundle).ToString().ToUpper(); + Cmd("powershell", "-NoProfile", "-NoLogo", Path.Combine(Dirs.RepoRoot, "packaging", "windows", "clisdk", "generatebundle.ps1"), - SdkMsi, SharedFrameworkMsi, SharedHostMsi, SdkBundle, WixRoot, MsiVersion, CliVersion, Arch, Channel) + SdkMsi, SharedFrameworkMsi, SharedHostMsi, SdkBundle, WixRoot, MsiVersion, CliVersion, upgradeCode, Arch, Channel) .EnvironmentVariable("Stage2Dir", Dirs.Stage2) .Execute() .EnsureSuccessful(); @@ -180,7 +185,7 @@ namespace Microsoft.DotNet.Cli.Build { var sharedFrameworkNuGetName = Monikers.SharedFrameworkName; var sharedFrameworkNuGetVersion = c.BuildContext.Get("SharedFrameworkNugetVersion"); - var upgradeCode = Utils.GenerateGuidFromName($"{sharedFrameworkNuGetName}-{sharedFrameworkNuGetVersion}-{Arch}-bundle").ToString().ToUpper(); + var upgradeCode = Utils.GenerateGuidFromName(SharedFrameworkBundle).ToString().ToUpper(); Cmd("powershell", "-NoProfile", "-NoLogo", Path.Combine(Dirs.RepoRoot, "packaging", "windows", "sharedframework", "generatebundle.ps1"), From 4186aca9980014ff7d9badff645cb2e3b70ba6a7 Mon Sep 17 00:00:00 2001 From: Sridhar Periyasamy Date: Fri, 25 Mar 2016 16:38:35 -0700 Subject: [PATCH 2/2] Make the bundle to be uninstallable and fix MSI tests. --- packaging/windows/clisdk/bundle.wxs | 10 ++++------ .../InstallationTests.cs | 13 ++++--------- .../PostInstallTests.cs | 7 ------- .../PostUninstallTests.cs | 2 +- 4 files changed, 9 insertions(+), 23 deletions(-) diff --git a/packaging/windows/clisdk/bundle.wxs b/packaging/windows/clisdk/bundle.wxs index 2c1f17fe1..533cd22d9 100644 --- a/packaging/windows/clisdk/bundle.wxs +++ b/packaging/windows/clisdk/bundle.wxs @@ -8,9 +8,7 @@ + Compressed="yes"> - + - + - + diff --git a/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/InstallationTests.cs b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/InstallationTests.cs index 9ce0be53d..8bbff333b 100644 --- a/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/InstallationTests.cs +++ b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/InstallationTests.cs @@ -22,21 +22,16 @@ namespace Dotnet.Cli.Msi.Tests _msiMgr = new MsiManager(msiFile); } - [Theory] - [InlineData("")] - [InlineData(@"%SystemDrive%\dotnet")] - public void InstallTest(string installLocation) + [Fact] + public void InstallTest() { - installLocation = Environment.ExpandEnvironmentVariables(installLocation); - string expectedInstallLocation = string.IsNullOrEmpty(installLocation) ? - Environment.ExpandEnvironmentVariables(@"%ProgramFiles%\dotnet") : - installLocation; + string expectedInstallLocation = Environment.ExpandEnvironmentVariables(@"%ProgramFiles%\dotnet"); // make sure that the msi is not already installed, if so the machine is in a bad state Assert.False(_msiMgr.IsInstalled, "The dotnet CLI msi is already installed"); Assert.False(Directory.Exists(expectedInstallLocation)); - _msiMgr.Install(installLocation); + _msiMgr.Install(); Assert.True(_msiMgr.IsInstalled); Assert.True(Directory.Exists(expectedInstallLocation)); diff --git a/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/PostInstallTests.cs b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/PostInstallTests.cs index 9a6cf9ff4..f637973e5 100644 --- a/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/PostInstallTests.cs +++ b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/PostInstallTests.cs @@ -45,12 +45,5 @@ namespace Dotnet.Cli.Msi.Tests Assert.Equal(_fixture.InstallLocation, regKey.GetValue("InstallDir")); Assert.NotNull(regKey.GetValue("Version")); } - - [Fact] - public void UpgradeCodeTest() - { - // magic number found in https://github.com/dotnet/cli/blob/master/packaging/windows/variables.wxi - Assert.Equal("{7D73E4F7-71E2-4236-8CF5-1C499BA3FF50}", _msiMgr.UpgradeCode); - } } } diff --git a/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/PostUninstallTests.cs b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/PostUninstallTests.cs index 0ae795142..0b71f5129 100644 --- a/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/PostUninstallTests.cs +++ b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/PostUninstallTests.cs @@ -23,7 +23,7 @@ namespace Dotnet.Cli.Msi.Tests Assert.False(Utils.ExistsOnPath("dotnet.exe"), "After uninstallation dotnet tools must not be on path"); } - [Fact] + [Fact(Skip = "https://github.com/dotnet/cli/issues/2073")] public void DotnetRegKeysTest() { Assert.True(_msiMgr.IsInstalled);