From aa512b771c82eee6e38d5b89050acb1af73f7173 Mon Sep 17 00:00:00 2001
From: Sridhar Periyasamy <sridhper@microsoft.com>
Date: Tue, 26 Apr 2016 18:00:02 -0700
Subject: [PATCH] Fix the branding in CLI windows installer

- All the branding is moved to Monikers.cs
- Fixed the bundle and msi to use that.

TODO: Do the same for OSx and Debian installers.
---
 packaging/windows/clisdk/bundle.wxl               |  2 +-
 packaging/windows/clisdk/bundle.wxs               |  1 +
 packaging/windows/clisdk/generatebundle.ps1       |  2 ++
 packaging/windows/clisdk/generatemsi.ps1          |  2 ++
 packaging/windows/clisdk/variables.wxi            |  2 +-
 packaging/windows/host/generatemsi.ps1            |  2 ++
 packaging/windows/host/variables.wxi              |  2 +-
 packaging/windows/sharedframework/bundle.wxl      |  2 +-
 packaging/windows/sharedframework/bundle.wxs      |  1 +
 .../windows/sharedframework/generatebundle.ps1    |  2 ++
 packaging/windows/sharedframework/generatemsi.ps1 |  2 ++
 packaging/windows/sharedframework/variables.wxi   |  2 +-
 scripts/dotnet-cli-build/MsiTargets.cs            | 15 ++++++++++-----
 scripts/dotnet-cli-build/Utils/Monikers.cs        |  3 +++
 14 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/packaging/windows/clisdk/bundle.wxl b/packaging/windows/clisdk/bundle.wxl
index 2d0aeafd4..c7ade785c 100644
--- a/packaging/windows/clisdk/bundle.wxl
+++ b/packaging/windows/clisdk/bundle.wxl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <WixLocalization Culture="en-us" Language="1033" xmlns="http://schemas.microsoft.com/wix/2006/localization">
   <String Id="Caption">[WixBundleName] Setup</String>
-  <String Id="Title">Microsoft .Net CLI for Windows</String>
+  <String Id="Title">[BUNDLEMONIKER]</String>
   <String Id="Motto">You just need a shell, a text editor and 10 minutes of your time.
 
 Ready? Set? Let's go!</String>
diff --git a/packaging/windows/clisdk/bundle.wxs b/packaging/windows/clisdk/bundle.wxs
index 1bb50e2e8..2a8caea94 100644
--- a/packaging/windows/clisdk/bundle.wxs
+++ b/packaging/windows/clisdk/bundle.wxs
@@ -24,6 +24,7 @@
     <swid:Tag Regid="microsoft.com" InstallPath="[DOTNETHOME]" />
 
     <Variable Name="DOTNETHOME" Type="string" Value="[ProgramFiles6432Folder]dotnet" bal:Overridable="yes" />
+    <Variable Name="BUNDLEMONIKER" Type="string" Value="$(var.ProductMoniker)" bal:Overridable="yes" />
 
     <util:RegistrySearch Id="PreviousInstallFolderSearch" Root="HKLM" Key="SOFTWARE\dotnet\Setup" Value="InstallDir" Variable="PreviousInstallFolder" />
     <util:DirectorySearch Path="[PreviousInstallFolder]" Variable="DOTNETHOME" After="PreviousInstallFolderSearch" Condition="PreviousInstallFolder" />
diff --git a/packaging/windows/clisdk/generatebundle.ps1 b/packaging/windows/clisdk/generatebundle.ps1
index f1beabc30..fd8084247 100644
--- a/packaging/windows/clisdk/generatebundle.ps1
+++ b/packaging/windows/clisdk/generatebundle.ps1
@@ -7,6 +7,7 @@ param(
     [Parameter(Mandatory=$true)][string]$SharedHostMSIFile,
     [Parameter(Mandatory=$true)][string]$DotnetBundleOutput,
     [Parameter(Mandatory=$true)][string]$WixRoot,
+    [Parameter(Mandatory=$true)][string]$ProductMoniker,
     [Parameter(Mandatory=$true)][string]$DotnetMSIVersion,
     [Parameter(Mandatory=$true)][string]$DotnetCLIDisplayVersion,
     [Parameter(Mandatory=$true)][string]$DotnetCLINugetVersion,
@@ -28,6 +29,7 @@ function RunCandleForBundle
     .\candle.exe -nologo `
         -dDotnetSrc="$inputDir" `
         -dMicrosoftEula="$RepoRoot\packaging\osx\clisdk\resources\en.lproj\eula.rtf" `
+        -dProductMoniker="$ProductMoniker" `
         -dBuildVersion="$DotnetMSIVersion" `
         -dDisplayVersion="$DotnetCLIDisplayVersion" `
         -dNugetVersion="$DotnetCLINugetVersion" `
diff --git a/packaging/windows/clisdk/generatemsi.ps1 b/packaging/windows/clisdk/generatemsi.ps1
index ba83887f8..7e1984891 100644
--- a/packaging/windows/clisdk/generatemsi.ps1
+++ b/packaging/windows/clisdk/generatemsi.ps1
@@ -5,6 +5,7 @@ param(
     [Parameter(Mandatory=$true)][string]$inputDir,
     [Parameter(Mandatory=$true)][string]$DotnetMSIOutput,
     [Parameter(Mandatory=$true)][string]$WixRoot,
+    [Parameter(Mandatory=$true)][string]$ProductMoniker,
     [Parameter(Mandatory=$true)][string]$DotnetMSIVersion,
     [Parameter(Mandatory=$true)][string]$DotnetCLIDisplayVersion,
     [Parameter(Mandatory=$true)][string]$DotnetCLINugetVersion,
@@ -48,6 +49,7 @@ function RunCandle
     .\candle.exe -nologo `
         -dDotnetSrc="$inputDir" `
         -dMicrosoftEula="$RepoRoot\packaging\osx\clisdk\resources\en.lproj\eula.rtf" `
+        -dProductMoniker="$ProductMoniker" `
         -dBuildVersion="$DotnetMSIVersion" `
         -dDisplayVersion="$DotnetCLIDisplayVersion" `
         -dNugetVersion="$DotnetCLINugetVersion" `
diff --git a/packaging/windows/clisdk/variables.wxi b/packaging/windows/clisdk/variables.wxi
index 2afbba0de..320984930 100644
--- a/packaging/windows/clisdk/variables.wxi
+++ b/packaging/windows/clisdk/variables.wxi
@@ -7,7 +7,7 @@
   <?define Dotnet_DisplayVersion   =   "$(var.DisplayVersion)" ?>
   <?define Dotnet_BuildVersion   =   "$(var.BuildVersion)" ?>
   <?define Manufacturer     =   "Microsoft Corporation" ?>
-  <?define ProductName      =   "Microsoft .NET Core CLI for Windows ($(var.NugetVersion))" ?>
+  <?define ProductName      =   "$(var.ProductMoniker) ($(var.NugetVersion) $(sys.BUILDARCH))" ?>
   <?define ProductLanguage  =   "1033" ?>
   <?define ProductVersion   =   "$(var.Dotnet_ProductVersion)" ?>
   <?define ProductFamily    =   "dotnet" ?>
diff --git a/packaging/windows/host/generatemsi.ps1 b/packaging/windows/host/generatemsi.ps1
index 97eb186de..84c9654c4 100644
--- a/packaging/windows/host/generatemsi.ps1
+++ b/packaging/windows/host/generatemsi.ps1
@@ -5,6 +5,7 @@ param(
     [Parameter(Mandatory=$true)][string]$SharedHostPublishRoot,
     [Parameter(Mandatory=$true)][string]$DotnetHostMSIOutput,
     [Parameter(Mandatory=$true)][string]$WixRoot,
+    [Parameter(Mandatory=$true)][string]$ProductMoniker,
     [Parameter(Mandatory=$true)][string]$DotnetMSIVersion,
     [Parameter(Mandatory=$true)][string]$DotnetCLIDisplayVersion,
     [Parameter(Mandatory=$true)][string]$DotnetCLINugetVersion,
@@ -28,6 +29,7 @@ function RunCandle
         -ext WixDependencyExtension.dll `
         -dHostSrc="$SharedHostPublishRoot" `
         -dMicrosoftEula="$RepoRoot\packaging\osx\clisdk\resources\en.lproj\eula.rtf" `
+        -dProductMoniker="$ProductMoniker" `
         -dBuildVersion="$DotnetMSIVersion" `
         -dDisplayVersion="$DotnetCLIDisplayVersion" `
         -dNugetVersion="$DotnetCLINugetVersion" `
diff --git a/packaging/windows/host/variables.wxi b/packaging/windows/host/variables.wxi
index 97c18491f..95fddd387 100644
--- a/packaging/windows/host/variables.wxi
+++ b/packaging/windows/host/variables.wxi
@@ -8,7 +8,7 @@
   <?define Dotnet_DisplayVersion   =   "$(var.DisplayVersion)" ?>
   <?define Dotnet_BuildVersion   =   "$(var.BuildVersion)" ?>
   <?define Manufacturer     =   "Microsoft Corporation" ?>
-  <?define ProductName      =   "Microsoft .NET Core Host for Windows ($(var.NugetVersion))" ?>
+  <?define ProductName      =   "$(var.ProductMoniker) ($(var.NugetVersion) $(sys.BUILDARCH))" ?>
   <?define ProductLanguage  =   "1033" ?>
   <?define ProductVersion   =   "$(var.Dotnet_ProductVersion)" ?>
   <?define LCID  = "$(var.ProductLanguage)"?>
diff --git a/packaging/windows/sharedframework/bundle.wxl b/packaging/windows/sharedframework/bundle.wxl
index 7f05329d6..c7ade785c 100644
--- a/packaging/windows/sharedframework/bundle.wxl
+++ b/packaging/windows/sharedframework/bundle.wxl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <WixLocalization Culture="en-us" Language="1033" xmlns="http://schemas.microsoft.com/wix/2006/localization">
   <String Id="Caption">[WixBundleName] Setup</String>
-  <String Id="Title">Microsoft .Net Core for Windows</String>
+  <String Id="Title">[BUNDLEMONIKER]</String>
   <String Id="Motto">You just need a shell, a text editor and 10 minutes of your time.
 
 Ready? Set? Let's go!</String>
diff --git a/packaging/windows/sharedframework/bundle.wxs b/packaging/windows/sharedframework/bundle.wxs
index 85cb613ff..07978bad5 100644
--- a/packaging/windows/sharedframework/bundle.wxs
+++ b/packaging/windows/sharedframework/bundle.wxs
@@ -24,6 +24,7 @@
     <swid:Tag Regid="microsoft.com" InstallPath="[DOTNETHOME]" />
 
     <Variable Name="DOTNETHOME" Type="string" Value="[ProgramFiles6432Folder]dotnet" bal:Overridable="yes" />
+    <Variable Name="BUNDLEMONIKER" Type="string" Value="$(var.ProductMoniker)" bal:Overridable="yes" />
 
     <util:RegistrySearch Id="PreviousInstallFolderSearch" Root="HKLM" Key="SOFTWARE\dotnet\sharedframework\$(var.FrameworkName) $(var.FrameworkDisplayVersion)\Setup" Value="InstallDir" Variable="PreviousInstallFolder" />
     <util:DirectorySearch Path="[PreviousInstallFolder]" Variable="DOTNETHOME" After="PreviousInstallFolderSearch" Condition="PreviousInstallFolder" />
diff --git a/packaging/windows/sharedframework/generatebundle.ps1 b/packaging/windows/sharedframework/generatebundle.ps1
index a9aaf0df3..23c564ac4 100644
--- a/packaging/windows/sharedframework/generatebundle.ps1
+++ b/packaging/windows/sharedframework/generatebundle.ps1
@@ -6,6 +6,7 @@ param(
     [Parameter(Mandatory=$true)][string]$SharedHostMSIFile,
     [Parameter(Mandatory=$true)][string]$DotnetBundleOutput,
     [Parameter(Mandatory=$true)][string]$WixRoot,
+    [Parameter(Mandatory=$true)][string]$ProductMoniker,
     [Parameter(Mandatory=$true)][string]$DotnetMSIVersion,
     [Parameter(Mandatory=$true)][string]$DotnetCLIVersion,
     [Parameter(Mandatory=$true)][string]$SharedFrameworkNugetName,
@@ -27,6 +28,7 @@ function RunCandleForBundle
 
     .\candle.exe -nologo `
         -dMicrosoftEula="$RepoRoot\packaging\osx\sharedframework\resources\en.lproj\eula.rtf" `
+        -dProductMoniker="$ProductMoniker" `
         -dBuildVersion="$DotnetMSIVersion" `
         -dDisplayVersion="$DotnetCLIVersion" `
         -dSharedFXMsiSourcePath="$SharedFxMSIFile" `
diff --git a/packaging/windows/sharedframework/generatemsi.ps1 b/packaging/windows/sharedframework/generatemsi.ps1
index 7788e7f4e..def4fddc6 100644
--- a/packaging/windows/sharedframework/generatemsi.ps1
+++ b/packaging/windows/sharedframework/generatemsi.ps1
@@ -5,6 +5,7 @@ param(
     [Parameter(Mandatory=$true)][string]$SharedFrameworkPublishRoot,
     [Parameter(Mandatory=$true)][string]$SharedFrameworkMSIOutput,
     [Parameter(Mandatory=$true)][string]$WixRoot,
+    [Parameter(Mandatory=$true)][string]$ProductMoniker,
     [Parameter(Mandatory=$true)][string]$DotnetMSIVersion,
     [Parameter(Mandatory=$true)][string]$SharedFrameworkNugetName,
     [Parameter(Mandatory=$true)][string]$SharedFrameworkNugetVersion,
@@ -60,6 +61,7 @@ function RunCandle
         -out "$WixObjRoot\" `
         -dSharedFrameworkSource="$SharedFrameworkPublishRoot" `
         -dMicrosoftEula="$RepoRoot\packaging\osx\sharedframework\resources\en.lproj\eula.rtf" `
+        -dProductMoniker="$ProductMoniker" `
         -dFrameworkName="$SharedFrameworkNugetName" `
         -dFrameworkDisplayVersion="$SharedFrameworkNugetVersion" `
         -dFrameworkComponentVersion="$SharedFrameworkComponentVersion" `
diff --git a/packaging/windows/sharedframework/variables.wxi b/packaging/windows/sharedframework/variables.wxi
index 8d54449e6..465033b92 100644
--- a/packaging/windows/sharedframework/variables.wxi
+++ b/packaging/windows/sharedframework/variables.wxi
@@ -5,7 +5,7 @@
   <?define Servicing_Key_SPIndex   =   "0" ?>
   <?define Servicing_Key_SPName   =   "Beta" ?>
   <?define Manufacturer     =   "Microsoft Corporation" ?>
-  <?define ProductName      =   "Microsoft .NET Core ($(var.FrameworkName) $(var.FrameworkDisplayVersion))" ?>
+  <?define ProductName      =   "$(var.ProductMoniker) ($(var.FrameworkName) $(var.FrameworkDisplayVersion) $(sys.BUILDARCH))" ?>
   <?define ProductLanguage  =   "1033" ?>
   <?define ProductVersion   =   "$(var.BuildVersion)" ?>
   <?define LCID  = "$(var.ProductLanguage)"?>
diff --git a/scripts/dotnet-cli-build/MsiTargets.cs b/scripts/dotnet-cli-build/MsiTargets.cs
index b5c26d32a..5f2d47793 100644
--- a/scripts/dotnet-cli-build/MsiTargets.cs
+++ b/scripts/dotnet-cli-build/MsiTargets.cs
@@ -124,10 +124,11 @@ namespace Microsoft.DotNet.Cli.Build
         {
             var cliSdkRoot = c.BuildContext.Get<string>("CLISDKRoot");
             var upgradeCode = Utils.GenerateGuidFromName(SdkMsi).ToString().ToUpper();
+            var cliSdkBrandName = $"'{Monikers.CLISDKBrandName}'";
 
             Cmd("powershell", "-NoProfile", "-NoLogo",
                 Path.Combine(Dirs.RepoRoot, "packaging", "windows", "clisdk", "generatemsi.ps1"),
-                cliSdkRoot, SdkMsi, WixRoot, MsiVersion, CliDisplayVersion, CliNugetVersion, upgradeCode, Arch)
+                cliSdkRoot, SdkMsi, WixRoot, cliSdkBrandName, MsiVersion, CliDisplayVersion, CliNugetVersion, upgradeCode, Arch)
                     .Execute()
                     .EnsureSuccessful();
             return c.Success();
@@ -139,6 +140,7 @@ namespace Microsoft.DotNet.Cli.Build
         {
             var inputDir = c.BuildContext.Get<string>("SharedHostPublishRoot");
             var wixObjRoot = Path.Combine(Dirs.Output, "obj", "wix", "sharedhost");
+            var sharedHostBrandName = $"'{Monikers.SharedHostBrandName}'";
 
             if (Directory.Exists(wixObjRoot))
             {
@@ -148,7 +150,7 @@ namespace Microsoft.DotNet.Cli.Build
 
             Cmd("powershell", "-NoProfile", "-NoLogo",
                 Path.Combine(Dirs.RepoRoot, "packaging", "windows", "host", "generatemsi.ps1"),
-                inputDir, SharedHostMsi, WixRoot, MsiVersion, CliDisplayVersion, CliNugetVersion, Arch, wixObjRoot)
+                inputDir, SharedHostMsi, WixRoot, sharedHostBrandName, MsiVersion, CliDisplayVersion, CliNugetVersion, Arch, wixObjRoot)
                     .Execute()
                     .EnsureSuccessful();
             return c.Success();
@@ -164,6 +166,7 @@ namespace Microsoft.DotNet.Cli.Build
             var msiVerison = sharedFrameworkNuGetVersion.Split('-')[0];
             var upgradeCode = Utils.GenerateGuidFromName(SharedFrameworkMsi).ToString().ToUpper();
             var wixObjRoot = Path.Combine(Dirs.Output, "obj", "wix", "sharedframework");
+            var sharedFxBrandName = $"'{Monikers.SharedFxBrandName}'";
 
             if (Directory.Exists(wixObjRoot))
             {
@@ -173,7 +176,7 @@ namespace Microsoft.DotNet.Cli.Build
 
             Cmd("powershell", "-NoProfile", "-NoLogo",
                 Path.Combine(Dirs.RepoRoot, "packaging", "windows", "sharedframework", "generatemsi.ps1"),
-                inputDir, SharedFrameworkMsi, WixRoot, msiVerison, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, Arch, wixObjRoot)
+                inputDir, SharedFrameworkMsi, WixRoot, sharedFxBrandName, msiVerison, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, Arch, wixObjRoot)
                     .Execute()
                     .EnsureSuccessful();
             return c.Success();
@@ -185,10 +188,11 @@ namespace Microsoft.DotNet.Cli.Build
         public static BuildTargetResult GenerateCliSdkBundle(BuildTargetContext c)
         {
             var upgradeCode = Utils.GenerateGuidFromName(SdkBundle).ToString().ToUpper();
+            var cliSdkBrandName = $"'{Monikers.CLISDKBrandName}'";
 
             Cmd("powershell", "-NoProfile", "-NoLogo",
                 Path.Combine(Dirs.RepoRoot, "packaging", "windows", "clisdk", "generatebundle.ps1"),
-                SdkMsi, SharedFrameworkMsi, SharedHostMsi, SdkBundle, WixRoot, MsiVersion, CliDisplayVersion, CliNugetVersion, upgradeCode, Arch)
+                SdkMsi, SharedFrameworkMsi, SharedHostMsi, SdkBundle, WixRoot, cliSdkBrandName, MsiVersion, CliDisplayVersion, CliNugetVersion, upgradeCode, Arch)
                     .EnvironmentVariable("Stage2Dir", Dirs.Stage2)
                     .Execute()
                     .EnsureSuccessful();
@@ -202,10 +206,11 @@ namespace Microsoft.DotNet.Cli.Build
             var sharedFrameworkNuGetName = Monikers.SharedFrameworkName;
             var sharedFrameworkNuGetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
             var upgradeCode = Utils.GenerateGuidFromName(SharedFrameworkBundle).ToString().ToUpper();
+            var sharedFxBrandName = $"'{Monikers.SharedFxBrandName}'";
 
             Cmd("powershell", "-NoProfile", "-NoLogo",
                 Path.Combine(Dirs.RepoRoot, "packaging", "windows", "sharedframework", "generatebundle.ps1"),
-                SharedFrameworkMsi, SharedHostMsi, SharedFrameworkBundle, WixRoot, MsiVersion, CliDisplayVersion, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, Arch)
+                SharedFrameworkMsi, SharedHostMsi, SharedFrameworkBundle, WixRoot, sharedFxBrandName, MsiVersion, CliDisplayVersion, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, Arch)
                     .Execute()
                     .EnsureSuccessful();
             return c.Success();
diff --git a/scripts/dotnet-cli-build/Utils/Monikers.cs b/scripts/dotnet-cli-build/Utils/Monikers.cs
index 91dd0e665..6f56b813e 100644
--- a/scripts/dotnet-cli-build/Utils/Monikers.cs
+++ b/scripts/dotnet-cli-build/Utils/Monikers.cs
@@ -9,6 +9,9 @@ namespace Microsoft.DotNet.Cli.Build
     public class Monikers
     {
         public const string SharedFrameworkName = "Microsoft.NETCore.App";
+        public const string CLISDKBrandName = "Microsoft .NET Core SDK";
+        public const string SharedFxBrandName = "Microsoft .NET Core";
+        public const string SharedHostBrandName = "Microsoft .NET Core Host";
 
         public static string GetProductMoniker(BuildTargetContext c, string artifactPrefix, string version)
         {