diff --git a/build.proj b/build.proj index 759701fad16b..395144c5936e 100644 --- a/build.proj +++ b/build.proj @@ -384,7 +384,7 @@ - + @@ -477,7 +477,7 @@ Condition="'$(Scope)' != 'Stack'" ContinueOnError="false" /> - + diff --git a/setup/InstallerChecks.CA.dll b/setup/InstallerChecks.CA.dll new file mode 100644 index 000000000000..9b54f9cbe29a Binary files /dev/null and b/setup/InstallerChecks.CA.dll differ diff --git a/setup/InstallerChecks/InstallerChecks.sln b/setup/InstallerChecks/InstallerChecks.sln new file mode 100644 index 000000000000..b89924246856 --- /dev/null +++ b/setup/InstallerChecks/InstallerChecks.sln @@ -0,0 +1,33 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2042 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InstallerChecks", "InstallerChecks\InstallerChecks.csproj", "{7EF9DF25-4A64-465E-B64C-76E0D6D94A93}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7EF9DF25-4A64-465E-B64C-76E0D6D94A93}.Debug|Any CPU.ActiveCfg = Debug|x64 + {7EF9DF25-4A64-465E-B64C-76E0D6D94A93}.Debug|x64.ActiveCfg = Debug|x64 + {7EF9DF25-4A64-465E-B64C-76E0D6D94A93}.Debug|x64.Build.0 = Debug|x64 + {7EF9DF25-4A64-465E-B64C-76E0D6D94A93}.Debug|x86.ActiveCfg = Debug|x64 + {7EF9DF25-4A64-465E-B64C-76E0D6D94A93}.Release|Any CPU.ActiveCfg = Release|x64 + {7EF9DF25-4A64-465E-B64C-76E0D6D94A93}.Release|x64.ActiveCfg = Release|x64 + {7EF9DF25-4A64-465E-B64C-76E0D6D94A93}.Release|x64.Build.0 = Release|x64 + {7EF9DF25-4A64-465E-B64C-76E0D6D94A93}.Release|x86.ActiveCfg = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {89994462-D746-4F79-8205-4407E6549E10} + EndGlobalSection +EndGlobal diff --git a/setup/InstallerChecks/InstallerChecks/InstallerChecks.config b/setup/InstallerChecks/InstallerChecks/InstallerChecks.config new file mode 100644 index 000000000000..c837a2cee30d --- /dev/null +++ b/setup/InstallerChecks/InstallerChecks/InstallerChecks.config @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + diff --git a/setup/InstallerChecks/InstallerChecks/InstallerChecks.cs b/setup/InstallerChecks/InstallerChecks/InstallerChecks.cs new file mode 100644 index 000000000000..15c0dcaef7d8 --- /dev/null +++ b/setup/InstallerChecks/InstallerChecks/InstallerChecks.cs @@ -0,0 +1,51 @@ +using Microsoft.Deployment.WindowsInstaller; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +namespace InstallerChecks +{ + public class InstallerChecks + { + [CustomAction] + public static ActionResult CheckForAzureRm(Session session) + { + List AzureModules = new List { "Azure.AnalysisServices", "Azure.Storage", "AzureRM", "AzureRM.AnalysisServices", + "AzureRM.ApiManagement", "AzureRM.ApplicationInsights", "AzureRM.Automation", "AzureRM.Backup", "AzureRM.Batch", "AzureRM.Billing", + "AzureRM.Cdn", "AzureRM.CognitiveServices", "AzureRM.Compute", "AzureRM.Compute.Experiments", "AzureRM.Consumption", + "AzureRM.ContainerInstance", "AzureRM.ContainerRegistry", "AzureRM.DataFactories", "AzureRM.DataFactoryV2", "AzureRM.DataLakeAnalytics", + "AzureRM.DataLakeStore", "AzureRM.DataMigration", "AzureRM.DevTestLabs", "AzureRM.Dns", "AzureRM.EventGrid", "AzureRM.EventHub", + "AzureRM.HDInsight", "AzureRM.Insights", "AzureRM.IotHub", "AzureRM.KeyVault", "AzureRM.LogicApp", "AzureRM.MachineLearning", + "AzureRM.MachineLearningCompute", "AzureRM.ManagementPartner", "AzureRM.Maps", "AzureRM.MarketplaceOrdering", "AzureRM.Media", + "AzureRM.Network", "AzureRM.NotificationHubs", "AzureRM.OperationalInsights", "AzureRM.PolicyInsights", "AzureRM.PowerBIEmbedded", + "AzureRM.profile", "AzureRM.RecoveryServices", "AzureRM.RecoveryServices.Backup", "AzureRM.RecoveryServices.SiteRecovery", + "AzureRM.RedisCache", "AzureRM.Relay", "AzureRM.Reservations", "AzureRM.Resources", "AzureRM.Scheduler", "AzureRM.ServerManagement", + "AzureRM.ServiceBus", "AzureRM.ServiceFabric", "AzureRM.SignalR", "AzureRM.SiteRecovery", "AzureRM.Sql", "AzureRM.Storage", + "AzureRM.StreamAnalytics", "AzureRM.Subscription.Preview", "AzureRM.Tags", "AzureRM.TrafficManager", "AzureRM.UsageAggregates", + "AzureRM.Websites", "AzureRM.Websites.Experiments"}; + + session.Log("Begin CustomAction"); + var paths = Environment.GetEnvironmentVariable("PSModulePath").Split(';'); + foreach (var path in paths) + { + if (Directory.Exists(path)) + { + var modules = Directory.GetDirectories(path); + foreach (var module in modules) + { + var moduleName = module.Split(Path.DirectorySeparatorChar).LastOrDefault(); + if (AzureModules.Any(x => string.Equals(x, moduleName, StringComparison.OrdinalIgnoreCase))) + { + Record record = new Record(2); + record.FormatString = Properties.Resources.AzureRmDetected; + session.Message(InstallMessage.Error, record); + return ActionResult.Failure; + } + } + } + } + return ActionResult.Success; + } + } +} \ No newline at end of file diff --git a/setup/InstallerChecks/InstallerChecks/InstallerChecks.csproj b/setup/InstallerChecks/InstallerChecks/InstallerChecks.csproj new file mode 100644 index 000000000000..278f52e0e85c --- /dev/null +++ b/setup/InstallerChecks/InstallerChecks/InstallerChecks.csproj @@ -0,0 +1,67 @@ + + + + Debug + x64 + 8.0.30703 + 2.0 + {7EF9DF25-4A64-465E-B64C-76E0D6D94A93} + Library + Properties + InstallerChecks + InstallerChecks + v3.5 + 512 + + + + true + bin\Debug\ + DEBUG;TRACE + full + x64 + prompt + MinimumRecommendedRules.ruleset + + + bin\Release\ + TRACE + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + + + + + + + + + True + + + + + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + + \ No newline at end of file diff --git a/setup/InstallerChecks/InstallerChecks/Properties/AssemblyInfo.cs b/setup/InstallerChecks/InstallerChecks/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..65c5f05b2681 --- /dev/null +++ b/setup/InstallerChecks/InstallerChecks/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("InstallerChecks")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("InstallerChecks")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f2ac8c5c-97a7-4b8e-97bd-ed30ac1135e5")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/setup/InstallerChecks/InstallerChecks/Properties/Resources.Designer.cs b/setup/InstallerChecks/InstallerChecks/Properties/Resources.Designer.cs new file mode 100644 index 000000000000..d2a7451cd123 --- /dev/null +++ b/setup/InstallerChecks/InstallerChecks/Properties/Resources.Designer.cs @@ -0,0 +1,72 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace InstallerChecks.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("InstallerChecks.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to AzureRM modules detected on your machine, please remove all AzureRM modules before running Az installer.. + /// + internal static string AzureRmDetected { + get { + return ResourceManager.GetString("AzureRmDetected", resourceCulture); + } + } + } +} diff --git a/setup/InstallerChecks/InstallerChecks/Properties/Resources.resx b/setup/InstallerChecks/InstallerChecks/Properties/Resources.resx new file mode 100644 index 000000000000..d9a00c4e07ae --- /dev/null +++ b/setup/InstallerChecks/InstallerChecks/Properties/Resources.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + AzureRM modules detected on your machine, please remove all AzureRM modules before running Az installer. + + \ No newline at end of file diff --git a/setup/azurecmd.wxs b/setup/azurecmd.wxs index cf961fdb531b..70984d34f873 100644 --- a/setup/azurecmd.wxs +++ b/setup/azurecmd.wxs @@ -5,7 +5,7 @@ Language="1033" Version="$(var.version)" Manufacturer="Microsoft Corporation" - UpgradeCode="EBC1AD5E-1BBE-45B5-9E8D-ACFC8951C252"> + UpgradeCode="EBC1AD5E-1BBE-45B5-9E8D-ACFC8951C253"> @@ -30,10 +30,37 @@ - - < "5.0")]]> + + < "5.1")]]> + + + + + + + = "#$(var.NetFx472MinRelease)"]]> + + + + + + + + + + @@ -51,7 +78,7 @@ - + diff --git a/setup/generate.ps1 b/setup/generate.ps1 index 906d67227c10..5408f8c6fcf1 100644 --- a/setup/generate.ps1 +++ b/setup/generate.ps1 @@ -8,7 +8,7 @@ .PARAMETER Version The version number for the generated MSI. .PARAMETER Force - Forces a fresh installation of the Azure and AzureRm cmdlets from the gallery + Forces a fresh installation of the Az cmdlets from the gallery .PARAMETER noBuildNumber Prevent a build number from being tacked on the end of the version number. .PARAMETER repository @@ -16,7 +16,7 @@ #> param( - [Parameter(HelpMessage="The version number for the generated MSI. This will be obtained from the AzureRM module if not specified.")] + [Parameter(HelpMessage="The version number for the generated MSI. This will be obtained from the Az module if not specified.")] [string]$version="0", [Parameter(HelpMessage="Prevent a build number from being tacked on the end of the version number.")] @@ -34,7 +34,7 @@ if( (-not (get-command -ea 0 light)) -or (-not (get-command -ea 0 heat)) -or (-n # variables # output filename (plus '-$version-$arch.msi' ) -$outputName ="Azure-Cmdlets" +$outputName ="Az-Cmdlets" # generate the product name from the current month/year. $productName = "Microsoft Azure PowerShell - $((Get-Culture).DateTimeFormat.GetMonthName((get-date).month)) $((get-date).year)" @@ -68,12 +68,11 @@ if ( -not (test-path $modulesDir)) { $shh= mkdir -ea 0 $modulesDir # First install the modules locally - save-module azure -path $modulesDir -Repository $repository - save-module azurerm -path $modulesDir -Repository $repository + save-module az -path $modulesDir -Repository $repository if ($version -eq "0") { - $version = (Get-ChildItem -Path $modulesDir\AzureRM).Name + $version = (Get-ChildItem -Path $modulesDir\Az).Name } Write-Host -fore green "Tweaking Modules"