|
8 | 8 | <?define version="1.0.1" ?>
|
9 | 9 | <?define versionedStartMenuFolder="Microsoft Azure" ?>
|
10 | 10 | <?define staleStartMenuFolder="Windows Azure" ?>
|
11 |
| - |
| 11 | + |
12 | 12 | <Product Id="*"
|
13 | 13 | Name="$(var.productName)"
|
14 | 14 | Language="1033"
|
|
41 | 41 |
|
42 | 42 | <SetProperty Id="POWERSHELLEXE" Value="[WindowsFolder]System32\WindowsPowerShell\v1.0\powershell.exe" Before="AppSearch"/>
|
43 | 43 |
|
44 |
| - <Property Id="POWERSHELLGETMODULESINSTALLED" > |
45 |
| - <DirectorySearch Id="PROGRAMFILESCONTAINER" Path="[BaseModulesFolder]"> |
46 |
| - <DirectorySearch Id= "PROFILEMODULE" Path="AzureRM.Profile"/> |
47 |
| - </DirectorySearch> |
48 |
| - </Property> |
49 |
| - |
50 |
| - <Property Id="POWERSHELLGETAZUREINSTALLED" > |
51 |
| - <DirectorySearch Id="AZURECONTAINER" Path="[BaseModulesFolder]"> |
52 |
| - <DirectorySearch Id= "AZUREMODULE" Path="Azure"/> |
53 |
| - </DirectorySearch> |
54 |
| - </Property> |
55 |
| - |
56 |
| - <Condition Message="Azure Modules from the PowerShell Gallery are installed on this machine. Please remove these modules before installing this MSI."> |
57 |
| - <![CDATA[Installed or NOT(POWERSHELLGETMODULESINSTALLED >< "AzureRM.Profile")]]> |
58 |
| - </Condition> |
59 |
| - |
60 |
| - <Condition Message="Azure Modules from the PowerShell Gallery are installed on this machine. Please remove these modules before installing this MSI."> |
61 |
| - <![CDATA[Installed or NOT(POWERSHELLGETAZUREINSTALLED >< "Azure")]]> |
62 |
| - </Condition> |
63 |
| - |
64 |
| - |
65 | 44 | <Condition Message="This setup requires the Windows PowerShell 3.0 or compatible version to be installed.">
|
66 | 45 | <!-- This condition will break if PowerShell has version x3.0 and it is not compatible with 3.0 -->
|
67 | 46 | <![CDATA[Installed or (PSCOMPATIBLEVERSION >< "3.0")]]>
|
|
88 | 67 | </Directory>
|
89 | 68 |
|
90 | 69 | <Property Id="POWERSHELLPATH">
|
91 |
| - <RegistrySearch Id="POWERSHELLPATH" |
92 |
| - Type="raw" |
93 |
| - Root="HKLM" |
94 |
| - Key="SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine" |
95 |
| - Name="ApplicationBase" /> |
| 70 | + <RegistrySearch Id="POWERSHELLPATH" |
| 71 | + Type="raw" |
| 72 | + Root="HKLM" |
| 73 | + Key="SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine" |
| 74 | + Name="ApplicationBase" /> |
96 | 75 | </Property>
|
97 | 76 |
|
98 | 77 | <DirectoryRef Id="PowerShellFolder">
|
99 | 78 | <Component Id="PSModulePath.System" Guid="273525B9-7AAB-421A-90C8-8E50A1840B8D">
|
100 | 79 | <CreateFolder />
|
101 | 80 | <!-- Work around bug that PowerShell does not always consider default module paths. -->
|
102 | 81 | <Environment Id="PSModulePath.SystemAppRoot" Action="set" Name="PSMODULEPATH" Part="last" Value="[BaseModulesFolder];[PowerShellFolder]ResourceManager\AzureResourceManager;[PowerShellFolder]ServiceManagement" System="yes" />
|
103 |
| - </Component> |
| 82 | + </Component> |
104 | 83 | </DirectoryRef>
|
105 | 84 |
|
106 | 85 | <DirectoryRef Id="PowerShellFolder">
|
|
109 | 88 | </Component>
|
110 | 89 | </DirectoryRef>
|
111 | 90 |
|
| 91 | + <DirectoryRef Id="PowerShellFolder"> |
| 92 | + <Component Id="AzureSdkRemoveModulesScript" Guid="7d75fe67-88e4-40da-bc3d-874cb0438d30"> |
| 93 | + <File Id="AzureSdkRemoveModulesScriptFile" KeyPath="yes" Source="$(var.SolutionDir)\Setup\RemoveGalleryModules.ps1" /> |
| 94 | + </Component> |
| 95 | + </DirectoryRef> |
| 96 | + |
112 | 97 | <DirectoryRef Id="AzureSdkMenu">
|
113 | 98 | <Component Id="AzureSdkShortcut" Guid="A9B58A22-F746-451D-8840-F887D8014C3C">
|
114 | 99 | <Shortcut Id="AzureSdkStartMenuShortcut"
|
|
127 | 112 | <ComponentRef Id="PSModulePath.System" />
|
128 | 113 | <ComponentRef Id="AzureSdkShortcut" />
|
129 | 114 | <ComponentRef Id="AzureSdkExecutionPolicyScript" />
|
130 |
| - </Feature> |
| 115 | + <ComponentRef Id="AzureSdkRemoveModulesScript" /> |
| 116 | + </Feature> |
131 | 117 |
|
132 | 118 | <Binary Id="CustomActions" SourceFile="$(var.caSourceDir)\Microsoft.WindowsAzure.Setup.CA.dll"/>
|
133 | 119 | <CustomAction Id="UpdatePSShortcut" BinaryKey="CustomActions" DllEntry="UpdatePSShortcut" Execute ="deferred" Impersonate="no"/>
|
134 | 120 | <CustomAction Id="SetCustomActionDataValue" Return="check" Property="UpdatePSShortcut"
|
135 | 121 | Value="ShortcutPath=[AzureSdkMenu]Microsoft Azure PowerShell.lnk;DefaultShortcutPath=[ProgramMenuFolder]System Tools\Windows PowerShell.lnk" />
|
136 | 122 | <CustomAction Id="SetExecutionPolicy" Property="POWERSHELLEXE" ExeCommand="-NoLogo -NoProfile -ExecutionPolicy Bypass -Command ". \"[PowerShellFolder]SetExecutionPolicy.ps1\""" Execute="deferred" Impersonate="no" Return="check"/>
|
| 123 | + <CustomAction Id="RemoveGalleryModules" Property="POWERSHELLEXE" ExeCommand="-NoLogo -NoProfile -ExecutionPolicy Bypass -Command ". \"[PowerShellFolder]RemoveGalleryModules.ps1\""" Execute="deferred" Impersonate="no" Return="check"/> |
137 | 124 |
|
138 | 125 | <InstallExecuteSequence>
|
139 | 126 | <Custom Action="SetCustomActionDataValue" After="CreateShortcuts">NOT Installed</Custom>
|
140 |
| - <Custom Action="UpdatePSShortcut" After="SetCustomActionDataValue">NOT Installed</Custom> |
| 127 | + <Custom Action="RemoveGalleryModules" After="SetCustomActionDataValue">NOT Installed</Custom> |
| 128 | + <Custom Action="UpdatePSShortcut" After="RemoveGalleryModules">NOT Installed</Custom> |
141 | 129 | <Custom Action="SetExecutionPolicy" After="UpdatePSShortcut">NOT Installed</Custom>
|
142 | 130 | </InstallExecuteSequence>
|
143 | 131 |
|
|
0 commit comments