Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement WiX based MSI setup #38008

Closed
wants to merge 4 commits into from
Closed
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
72 changes: 72 additions & 0 deletions build/wix/Build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
@ECHO OFF

REM Change version numbers here:
SET PRODUCT_MAJOR_VERSION=1
SET PRODUCT_MINOR_VERSION=18
SET PRODUCT_MAINTENANCE_VERSION=0

REM Configure available SDK version:
SET WIN_SDK_VERSION=8.1

REM
REM Nothing below this line need to be changed normally.
REM

SET PRODUCT_SKU=code
SET PRODUCT_VERSION=%PRODUCT_MAJOR_VERSION%.%PRODUCT_MINOR_VERSION%.%PRODUCT_MAINTENANCE_VERSION%

REM Generate one ID per release. But do NOT use * as we need to keep the same number for all languages and platforms.
SETLOCAL ENABLEDELAYEDEXPANSION
FOR /F %%G IN ('POWERSHELL -COMMAND "$([guid]::NewGuid().ToString('b').ToUpper())"') DO (
SET PRODUCT_ID=%%G
)

REM Generate platform specific builds
FOR %%G IN (x64,x86) DO (
ECHO Generate vscode setup for "%%G" platform
ECHO ****************************************
REM Cultures: https://msdn.microsoft.com/de-de/library/ee825488(v=cs.20).aspx
SET CULTURE=en-us
SET LANGIDS=1033
SET PLATFORM=%%G
SET SETUP_RESOURCES_DIR=.\Resources
SET REPRO_DIR=.\SourceDir\!PRODUCT_VERSION!\!PLATFORM!
SET OUTPUT_BASE_FILENAME=VSCodeSetup-!PLATFORM!-!PRODUCT_VERSION!

"!WIX!bin\heat.exe" dir "!REPRO_DIR!" -out Files-!OUTPUT_BASE_FILENAME!.wxs -t code.xsl -gg -sfrag -scom -sreg -srd -ke -cg "AppFiles" -var var.ProductMajorVersion -var var.ProductMinorVersion -var var.ProductMaintenanceVersion -var var.ReproDir -dr APPLICATIONFOLDER -platform !PLATFORM!
"!WIX!bin\candle.exe" -arch !PLATFORM! code.wxs Files-!OUTPUT_BASE_FILENAME!.wxs -ext WixUIExtension -ext WixUtilExtension -dProductMajorVersion="!PRODUCT_MAJOR_VERSION!" -dProductMinorVersion="!PRODUCT_MINOR_VERSION!" -dProductMaintenanceVersion="!PRODUCT_MAINTENANCE_VERSION!" -dProductId="!PRODUCT_ID!" -dReproDir="!REPRO_DIR!" -dSetupResourcesDir="!SETUP_RESOURCES_DIR!" -dCulture="!CULTURE!"
"!WIX!bin\light.exe" code.wixobj Files-!OUTPUT_BASE_FILENAME!.wixobj -ext WixUIExtension -ext WixUtilExtension -out "ReleaseDir\!OUTPUT_BASE_FILENAME!.msi" -loc "Lang\!PRODUCT_SKU!.!CULTURE!.wxl" -dWixUILicenseRtf="!SETUP_RESOURCES_DIR!\licenses\license.!CULTURE!.rtf" -cultures:!CULTURE! -sice:ICE60 -sice:ICE69

REM Generate setup translations
CALL BuildSetupTranslationTransform.cmd de-de 1031
CALL BuildSetupTranslationTransform.cmd es-es 3082
CALL BuildSetupTranslationTransform.cmd fr-fr 1036
CALL BuildSetupTranslationTransform.cmd it-it 1040
CALL BuildSetupTranslationTransform.cmd ja-jp 1041
CALL BuildSetupTranslationTransform.cmd ko-kr 1042
CALL BuildSetupTranslationTransform.cmd ru-ru 1049
CALL BuildSetupTranslationTransform.cmd zh-cn 2052
CALL BuildSetupTranslationTransform.cmd zh-tw 1028

REM Add all supported languages to MSI Package attribute
CSCRIPT "%ProgramFiles(x86)%\Windows Kits\%WIN_SDK_VERSION%\bin\x64\WiLangId.vbs" ReleaseDir\!OUTPUT_BASE_FILENAME!.msi Package !LANGIDS!

REM SIGN the MSI with digital signature
REM signtool sign /sha1 CertificateHash "ReleaseDir\!OUTPUT_BASE_FILENAME!.msi"
)
ENDLOCAL

REM Cleanup variables
SET CULTURE=
SET LANGIDS=
SET PRODUCT_SKU=
SET WIN_SDK_VERSION=
SET PRODUCT_MAJOR_VERSION=
SET PRODUCT_MINOR_VERSION=
SET PRODUCT_MAINTENANCE_VERSION=
SET PRODUCT_ID=
SET PRODUCT_VERSION=
SET PLATFORM=
SET SETUP_RESOURCES_DIR=
SET REPRO_DIR=
SET OUTPUT_BASE_FILENAME=
29 changes: 29 additions & 0 deletions build/wix/BuildSetupTranslationTransform.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@ECHO OFF
REM
REM Do not run this file at it's own. The Build.cmd in the same folder will call this file.
REM

IF EXIST "%1" = "" goto failed
IF EXIST "%2" = "" goto failed

SET CULTURE=%1
SET LANGID=%2

SET LANGIDS=%LANGIDS%,%LANGID%

ECHO Building setup translation for culture "%1" with LangID "%2"...
REM -dWixUILicenseRtf overrides the license file to current language.
"%WIX%bin\light.exe" code.wixobj Files-!OUTPUT_BASE_FILENAME!.wixobj -ext WixUIExtension -ext WixUtilExtension -spdb -out "ReleaseDir\!OUTPUT_BASE_FILENAME!.!CULTURE!.msi" -loc "Lang\%PRODUCT_SKU%.!CULTURE!.wxl" -dWixUILicenseRtf="!SETUP_RESOURCES_DIR!\licenses\license.!CULTURE!.rtf" -cultures:!CULTURE! -sice:ICE60 -sice:ICE69
cscript "%ProgramFiles(x86)%\Windows Kits\%WIN_SDK_VERSION%\bin\x64\WiLangId.vbs" ReleaseDir\!OUTPUT_BASE_FILENAME!.!CULTURE!.msi Product %LANGID%
"%ProgramFiles(x86)%\Windows Kits\%WIN_SDK_VERSION%\bin\x86\msitran" -g "ReleaseDir\!OUTPUT_BASE_FILENAME!.msi" "ReleaseDir\!OUTPUT_BASE_FILENAME!.!CULTURE!.msi" "ReleaseDir\!CULTURE!.mst"
cscript "%ProgramFiles(x86)%\Windows Kits\%WIN_SDK_VERSION%\bin\x64\wisubstg.vbs" ReleaseDir\!OUTPUT_BASE_FILENAME!.msi ReleaseDir\!CULTURE!.mst %LANGID%
cscript "%ProgramFiles(x86)%\Windows Kits\%WIN_SDK_VERSION%\bin\x64\wisubstg.vbs" ReleaseDir\!OUTPUT_BASE_FILENAME!.msi

del /Q "ReleaseDir\!OUTPUT_BASE_FILENAME!.!CULTURE!.msi"
del /Q "ReleaseDir\!CULTURE!.mst"
goto exit

:failed
ECHO Failed to generate setup translation of culture "%1" with LangID "%2".

:exit
27 changes: 27 additions & 0 deletions build/wix/Includes/codeVariables.wxi
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Include>
<!-- Setup UI strings. -->
<?if $(env.Platform)=x86?>
<?define ProgramFilesFolder="ProgramFilesFolder" ?>
<?define Win64="no" ?>
<?define Arch="(x86)" ?>
<?else?>
<?define ProgramFilesFolder="ProgramFiles64Folder" ?>
<?define Win64="yes" ?>
<?define Arch="(x64)" ?>
<?endif?>

<?define ProductVersion="$(var.ProductMajorVersion).$(var.ProductMinorVersion).$(var.ProductMaintenanceVersion)" ?>
<?define ProductName="!(loc.ProductName)" ?>
<?define ProductNameWithVersion="!(loc.ProductName) $(var.ProductMajorVersion).$(var.ProductMinorVersion).$(var.ProductMaintenanceVersion) $(var.Arch)" ?>
<?define ProductLanguage="!(loc.ProductLanguage)" ?>
<?define AppCodeName="VSCode" ?>
<?define AppName="Visual Studio Code" ?>
<?define AppFolderName="Microsoft VS Code" ?>
<?define ProductManufacturerShort="Microsoft" ?>
<?define ProductManufacturerLong="Microsoft Corporation" ?>

<!-- Static settings, DO NOT TOUCH or upgrades will break! -->
<?define ProductUpgradeCode="{AB0DB01E-C017-4AE5-876A-0224C5C7827C}" ?>
<?define RTMProductVersion="0.0.1" ?>
</Include>
24 changes: 24 additions & 0 deletions build/wix/Lang/code.en-us.wxl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="en-us" Codepage="1252" xmlns="http://schemas.microsoft.com/wix/2006/localization">
<String Id="ProductLanguage">1033</String>
<String Id="ProductName">Microsoft Visual Studio Code</String>
<String Id="ProductHelpLink">https://code.visualstudio.com/</String>
<String Id="ProductUrlInfoAbout">https://code.visualstudio.com/</String>
<String Id="ProductUrlUpdateInfo">https://code.visualstudio.com/</String>
<String Id="PackageDescription">Package with Visual Studio Code</String>
<String Id="FeatureStartMenuShortcutTitle">Start Menu shortcut</String>
<String Id="FeatureStartMenuShortcutDescription">Create a start menu icon.</String>
<String Id="FeatureDesktopShortcutTitle">Desktop shortcut</String>
<String Id="FeatureDesktopShortcutDescription">Create a desktop icon.</String>
<String Id="FeatureFileTypeAssociationsTitle">File Associations</String>
<String Id="FeatureFileTypeAssociationsDescription">Register Code as an editor for supported file types.</String>
<String Id="FeatureAddContextMenuFilesTitle">Files context menu</String>
<String Id="FeatureAddContextMenuFilesDescription">Add "Open with Code" action to Windows Explorer file contect menu.</String>
<String Id="FeatureAddContextMenuFoldersTitle">Directory context menu</String>
<String Id="FeatureAddContextMenuFoldersDescription">Add "Open with Code" action to Windows Explorer directory contect menu.</String>
<String Id="FeatureEnvironmentTitle">Add to PATH</String>
<String Id="FeatureEnvironmentDescription">Add Visual Studio Code to PATH environment variable. Available after restart.</String>
<String Id="LaunchApplication">Launch Visual Studio Code</String>
<String Id="NewerVersionInstalled">Newer version of Visual Studio Code is already installed.</String>
<String Id="OSVersionRequired">Windows 7 or later is required.</String>
</WixLocalization>
Loading