Skip to content

Instantly share code, notes, and snippets.

@igorzi
Created December 8, 2011 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igorzi/1449202 to your computer and use it in GitHub Desktop.
Save igorzi/1449202 to your computer and use it in GitHub Desktop.
From b24cdb3d362bd88e4a6486a589e9fb6c498f360b Mon Sep 17 00:00:00 2001
From: Igor Zinkovsky <igorzi@microsoft.com>
Date: Thu, 8 Dec 2011 15:00:48 -0800
Subject: [PATCH] Enable upgrades in MSI.
Fixes #2228.
---
tools/msvs/msi/nodemsi.wixproj | 4 ++--
tools/msvs/msi/product.wxs | 5 ++++-
vcbuild.bat | 4 +++-
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/tools/msvs/msi/nodemsi.wixproj b/tools/msvs/msi/nodemsi.wixproj
index e453724..96813d3 100644
--- a/tools/msvs/msi/nodemsi.wixproj
+++ b/tools/msvs/msi/nodemsi.wixproj
@@ -16,12 +16,12 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>..\..\..\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
- <DefineConstants>Debug;ProductVersion=$(NodeVersion);NPMSourceDir=..\..\..\deps\npm\</DefineConstants>
+ <DefineConstants>Debug;ProductVersion=$(NodeVersion);ProductId=$(NodeProductId);NPMSourceDir=..\..\..\deps\npm\</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\..\..\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
- <DefineConstants>Debug;ProductVersion=$(NodeVersion);NPMSourceDir=..\..\..\deps\npm\</DefineConstants>
+ <DefineConstants>Debug;ProductVersion=$(NodeVersion);ProductId=$(NodeProductId);NPMSourceDir=..\..\..\deps\npm\</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="product.wxs" />
diff --git a/tools/msvs/msi/product.wxs b/tools/msvs/msi/product.wxs
index d924a4d..b8b53b0 100644
--- a/tools/msvs/msi/product.wxs
+++ b/tools/msvs/msi/product.wxs
@@ -4,7 +4,7 @@
<?define repoDir="$(var.ProjectDir)..\..\..\" ?>
<?define sourcedir="$(var.repoDir)\$(var.Configuration)\" ?>
- <Product Id="cc6c176e-e26c-48ec-8970-f58bd1d046cf"
+ <Product Id="$(var.ProductId)"
Name="node.js"
Language="1033"
Version="$(var.ProductVersion)"
@@ -14,6 +14,9 @@
<Package InstallerVersion="200" Compressed="yes" Platform="x86" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
+
+ <MajorUpgrade AllowSameVersionUpgrades="yes"
+ DowngradeErrorMessage="A later version of node.js is already installed. Setup will now exit." />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
diff --git a/vcbuild.bat b/vcbuild.bat
index 38a1951..290e523 100644
--- a/vcbuild.bat
+++ b/vcbuild.bat
@@ -89,7 +89,9 @@ python "%~dp0tools\getnodeversion.py" > "%temp%\node_version.txt"
if not errorlevel 0 echo Cannot determine current version of node.js & goto exit
for /F "tokens=*" %%i in (%temp%\node_version.txt) do set NODE_VERSION=%%i
heat dir deps\npm -var var.NPMSourceDir -dr NodeModulesFolder -cg NPMFiles -gg -template fragment -nologo -out npm.wxs
-msbuild "%~dp0tools\msvs\msi\nodemsi.sln" /t:Clean,Build /p:Configuration=%config% /p:NodeVersion=%NODE_VERSION% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
+uuidgen > "%temp%\node_product_id.txt"
+set /p NODE_PRODUCT_ID=<"%temp%\node_product_id.txt"
+msbuild "%~dp0tools\msvs\msi\nodemsi.sln" /t:Clean,Build /p:Configuration=%config% /p:NodeVersion=%NODE_VERSION% /p:NodeProductId=%NODE_PRODUCT_ID% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
if errorlevel 1 goto exit
if defined nosign goto run
--
1.7.4.msysgit.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment