Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env27/
obj/
dist/
MANIFEST
packaged_releases/windows/out

# Result of running python setup.py install/pip install -e
RECORD.txt
Expand Down Expand Up @@ -73,7 +74,6 @@ private_config.json
scripts/smart_create_gen/config.ini
debug.log
test_results/
resources/

# Code coverage
.coverage
2 changes: 1 addition & 1 deletion packaged_releases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ $ shasum -a 256 azure-cli_packaged_{VERSION}.tar.gz
3 - Build/Release for Debian, Docker, Homebrew
----------------------------------------------

Follow the instructions in the `debian`, `docker` and `homebrew` subdirectories to create these releases.
Follow the instructions in the `debian`, `docker`, `windows` and `homebrew` subdirectories to create these releases.


4 - Modify HISTORY.md
Expand Down
131 changes: 131 additions & 0 deletions packaged_releases/windows/Product.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

<?define ProductVersion="0.2.3" ?>

<?define ProductName = "Microsoft Azure CLI 2.0" ?>
<?define ProductDescription = "Command-line tools for Azure." ?>
<?define ProductAuthor = "Microsoft Corporation" ?>
<?define ProductResources = ".\resources\" ?>

<Product Id="*"
Name="$(var.ProductName)"
Language="1033"
Version="$(var.ProductVersion)"
Manufacturer="$(var.ProductAuthor)"
UpgradeCode="dff82af0-3f95-4ac9-8efd-948604fdb028">

<Package InstallerVersion="200"
Compressed="yes"
InstallScope="perMachine" />

<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." Schedule="afterInstallInitialize" />

<Media Id="1" Cabinet="WindowsAzureCLI.cab" EmbedCab="yes" CompressionLevel="high" />

<Icon Id="AzureIcon" SourceFile="$(var.ProductResources)windowsazure.ico" />

<Property Id="ARPPRODUCTICON" Value="AzureIcon" />
<Property Id="ARPHELPLINK" Value="https://docs.microsoft.com/en-us/cli/azure" />
<Property Id="ARPURLINFOABOUT" Value="https://docs.microsoft.com/en-us/cli/azure/overview" />
<Property Id="ARPURLUPDATEINFO" Value="https://docs.microsoft.com/en-us/cli/azure/overview" />
<Property Id="ApplicationFolderName" Value="Microsoft SDKs\Azure" />
<Property Id="WixAppFolder" Value="WixPerMachineFolder" />

<Feature Id="ProductFeature"
Title="Microsoft Azure CLI 2.0"
Level="1"
AllowAdvertise="no">
<ComponentGroupRef Id="ProductComponents" />
</Feature>

<!--Custom action to propagate path env variable change-->
<Binary Id="PropagateEnvChangeExe" SourceFile=".\propagate_env_change\propagate_env_change.exe" />
<Property Id="WixQuietExecCmdLine" Value="propagate_env_change.exe"/>
<!--Ignoring the return value if case there is app-hang we can't control -->
<CustomAction Id="PropagateEnvChange"
BinaryKey="PropagateEnvChangeExe"
ExeCommand="propagate_env_change.exe"
Execute="commit"
Return="ignore"/>
<InstallExecuteSequence>
<Custom Action="PropagateEnvChange" Before="InstallFinalize" />
</InstallExecuteSequence>

<!-- User Interface -->
<WixVariable Id="WixUILicenseRtf" Value="$(var.ProductResources)CLI_LICENSE.rtf"/>
<WixVariable Id="WixUIDialogBmp" Value="$(var.ProductResources)Dialog.bmp" />
<WixVariable Id="WixUIBannerBmp" Value="$(var.ProductResources)Banner.bmp" />

<UIRef Id="WixUI_Minimal"/>

</Product>

<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="SDKFOLDER" Name="Microsoft SDKs">
<Directory Id="AZUREFOLDER" Name="Azure">
<Directory Id="AZURECLIFOLDER" Name="CLI2">
<Directory Id="DynamicCliDir"/>
<Directory Id="BIN" Name="Bin" />
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>

<Fragment>
<ComponentGroup Id="AzureCliSettingsGroup">
<Component Id="RemoveCLIFolder"
Directory="DynamicCliDir"
Guid="{24DA394D-B03D-4623-A0D9-852DB51EF9F4}">
<RemoveFolder Id="DynamicCliDir" On="uninstall" />
</Component>
<Component Id="RemoveAzureCLIFolder"
Directory="AZURECLIFOLDER"
Guid="{6AF97701-6A7A-4292-95D6-ED34CD4C97C0}">
<RemoveFolder Id="AZURECLIFOLDER" On="uninstall" />
</Component>
<Component Id="AzureCliSystemPath"
Directory="DynamicCliDir"
Guid="{3B60CA67-DB92-465A-BC96-3CA6CAEFF41B}">
<Environment Id="AzureCliAddedToPATH"
Name="PATH"
Value="[DynamicCliDir]wbin"
Permanent="no"
Part="last"
Action="set"
System="yes" />
<CreateFolder />
</Component>
<Component Id="AzureCliRegistry"
Directory="DynamicCliDir"
Guid="{BDEEE50E-70D3-4990-BFF9-FCF8114AA701}">
<RegistryValue Root="HKCU"
Key="Software\Microsoft\$(var.ProductName)"
Name="installed"
Type="integer"
Value="1"
KeyPath="yes"/>
</Component>
<Component Id="AzureCliVersion"
Directory="DynamicCliDir"
Guid="{A5647E93-02B7-4CED-802A-DDD7416E0231}">
<RegistryValue Root="HKLM"
Key="Software\Microsoft\$(var.ProductName)"
Name="version"
Type="string"
Value="$(var.ProductVersion)"
KeyPath="yes"/>
</Component>
</ComponentGroup>

<ComponentGroup Id="ProductComponents">
<ComponentGroupRef Id="AzureCliComponentGroup"/>
<ComponentGroupRef Id="AzureCliSettingsGroup"/>
</ComponentGroup>

</Fragment>
</Wix>
26 changes: 26 additions & 0 deletions packaged_releases/windows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Building the Windows MSI
========================

This document provides instructions on creating the MSI.

Prerequisites
-------------

1. Install 'WIX Toolset build tools' if not already installed.
http://wixtoolset.org/releases/

2. Get Git for Windows (it has several tools used for the build).
https://github.com/git-for-windows/git/releases/download/v2.12.2.windows.1/Git-2.12.2-32-bit.exe

3. Install 'Microsoft Build Tools 2015'.
https://www.microsoft.com/en-us/download/details.aspx?id=48159

Building
--------

1. Change the 'ProductVersion' in `Product.wxs` when creating a new release.
In `.\scripts\prepareRepoClone.cmd` also change the CLI_VERSION in there.

2. Run `build.cmd`.

3. The unsigned MSI will be in the `.\out` folder.
20 changes: 20 additions & 0 deletions packaged_releases/windows/azure-cli.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "azure-cli", "azure-cli.wixproj", "{9A0DC66D-3186-4EE4-B471-6C0F1DD6E159}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9A0DC66D-3186-4EE4-B471-6C0F1DD6E159}.Debug|x86.ActiveCfg = Debug|x86
{9A0DC66D-3186-4EE4-B471-6C0F1DD6E159}.Debug|x86.Build.0 = Debug|x86
{9A0DC66D-3186-4EE4-B471-6C0F1DD6E159}.Release|x86.ActiveCfg = Release|x86
{9A0DC66D-3186-4EE4-B471-6C0F1DD6E159}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
54 changes: 54 additions & 0 deletions packaged_releases/windows/azure-cli.wixproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Local WiX -->
<PropertyGroup>
<LocalWixRoot>$(HOMEDRIVE)$(HOMEPATH)\zwix\</LocalWixRoot>
<WixToolPath>$(LocalWixRoot)</WixToolPath>
<WixTargetsPath>$(WixToolPath)Wix.targets</WixTargetsPath>
<WixTasksPath>wixtasks.dll</WixTasksPath>
<AzureCliSource>$(HOMEDRIVE)$(HOMEPATH)\zcli</AzureCliSource>
<LinkerAdditionalOptions>-fv</LinkerAdditionalOptions>
</PropertyGroup>
<!-- Project -->
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.10</ProductVersion>
<ProjectGuid>9a0dc66d-3186-4ee4-b471-6c0f1dd6e159</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>Microsoft Azure CLI 2.0</OutputName>
<OutputType>Package</OutputType>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>out\$(Configuration)\</OutputPath>
<IntermediateOutputPath>out\obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug;AzureCliSource=$(AzureCliSource)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>out\</OutputPath>
<IntermediateOutputPath>out\obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>AzureCliSource=$(AzureCliSource)</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="out\azure-cli.wxs">
<Link>azure-cli.wxs</Link>
</Compile>
<Compile Include="Product.wxs" />
</ItemGroup>
<ItemGroup>
<None Include=".\resources\windowsazure.ico" />
</ItemGroup>
<!-- UI -->
<ItemGroup>
<WixExtension Include="WixUIExtension">
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
<Name>WixUIExtension</Name>
</WixExtension>
</ItemGroup>
<Import Project="$(WixTargetsPath)" />
<Target Name="BeforeBuild">
<HeatDirectory Directory="$(AzureCliSource)" ToolPath="$(WixToolPath)" AutogenerateGuids="true" ComponentGroupName="AzureCliComponentGroup" SuppressRootDirectory="true" DirectoryRefId="DynamicCliDir" OutputFile="out\azure-cli.wxs" PreprocessorVariable="var.AzureCliSource" />
</Target>
</Project>
21 changes: 21 additions & 0 deletions packaged_releases/windows/build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@echo off
echo Building the Windows Installer...
echo.
:: Add Git to the path as this should be run through a .NET command prompt
:: and not a Git bash shell... We also need the gnu toolchain (for curl & unzip)
set PATH=%PATH%;"C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\MSBuild\14.0\Bin"

pushd %~dp0

CALL scripts\prepareBuild.cmd
if %errorlevel% neq 0 exit /b %errorlevel%

echo Building MSI...
msbuild /t:rebuild /p:Configuration=Release

echo.

if not "%1"=="-noprompt" (
start .\out\
)
popd
14 changes: 14 additions & 0 deletions packaged_releases/windows/propagate_env_change/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "windows.h"

int main(int argc, LPCWSTR argv[])
{
LRESULT dwResult = SendMessageTimeout(HWND_BROADCAST,
WM_SETTINGCHANGE,
0,
(LPARAM)L"Environment",
SMTO_ABORTIFHUNG,
5000,
NULL);

return (dwResult) ? 0 : 1;
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "propagate_env_change", "propagate_env_change.vcxproj", "{3A0362EF-D3B7-4FFE-B866-D6104B32C129}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3A0362EF-D3B7-4FFE-B866-D6104B32C129}.Debug|Win32.ActiveCfg = Debug|Win32
{3A0362EF-D3B7-4FFE-B866-D6104B32C129}.Debug|Win32.Build.0 = Debug|Win32
{3A0362EF-D3B7-4FFE-B866-D6104B32C129}.Release|Win32.ActiveCfg = Release|Win32
{3A0362EF-D3B7-4FFE-B866-D6104B32C129}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Loading