changed installer from nsis to wix - attempting to fix "synwinxt.dll in use" error on upgrade.

This commit is contained in:
Nick Bolton 2014-03-07 19:41:08 +00:00
parent 64248beb4e
commit f7445a6aea
7 changed files with 213 additions and 8 deletions

View File

@ -407,7 +407,7 @@ class InternalCommands:
else: else:
for target in targets: for target in targets:
if generator.startswith('Visual Studio'): if generator.startswith('Visual Studio'):
self.run_vcbuild(generator, target) self.run_vcbuild(generator, target, self.sln_filepath())
elif generator == 'Xcode': elif generator == 'Xcode':
cmd = self.xcodebuild_cmd + ' -configuration ' + target.capitalize() cmd = self.xcodebuild_cmd + ' -configuration ' + target.capitalize()
self.runBuildCommand(cmd, target) self.runBuildCommand(cmd, target)
@ -560,12 +560,12 @@ class InternalCommands:
# special case for version 10, use new /target:clean # special case for version 10, use new /target:clean
if generator.startswith('Visual Studio 10'): if generator.startswith('Visual Studio 10'):
for target in targets: for target in targets:
self.run_vcbuild(generator, target, '/target:clean') self.run_vcbuild(generator, target, self.sln_filepath(), '/target:clean')
# any other version of visual studio, use /clean # any other version of visual studio, use /clean
elif generator.startswith('Visual Studio'): elif generator.startswith('Visual Studio'):
for target in targets: for target in targets:
self.run_vcbuild(generator, target, '/clean') self.run_vcbuild(generator, target, self.sln_filepath(), '/clean')
else: else:
cmd = '' cmd = ''
@ -685,7 +685,8 @@ class InternalCommands:
elif type == 'win': elif type == 'win':
if sys.platform == 'win32': if sys.platform == 'win32':
self.distNsis(vcRedistDir, qtDir) #self.distNsis(vcRedistDir, qtDir)
self.distWix()
else: else:
package_unsupported = True package_unsupported = True
@ -771,6 +772,33 @@ class InternalCommands:
err = os.system(cmd) err = os.system(cmd)
self.restore_chdir() self.restore_chdir()
def distWix(self):
generator = self.getGeneratorFromConfig().cmakeName
arch = 'x86'
if generator.endswith('Win64'):
arch = 'x64'
version = self.getVersionFromCmake()
args = "/p:DefineConstants=\"Version=%s\"" % version
self.run_vcbuild(generator, 'release', 'synergy.sln', args, 'src/setup/win32/')
filename = "%s-%s-Windows-%s.msi" % (
self.project,
version,
arch)
old = "bin/Release/synergy.msi"
new = "bin/Release/%s" % (filename)
try:
os.remove(new)
except OSError:
pass
os.rename(old, new)
def distNsis(self, vcRedistDir, qtDir): def distNsis(self, vcRedistDir, qtDir):
if vcRedistDir == '': if vcRedistDir == '':
@ -872,7 +900,7 @@ class InternalCommands:
elif type == 'win': elif type == 'win':
# get platform based on last generator used # get platform based on last generator used
ext = 'exe' ext = 'msi'
generator = self.getGeneratorFromConfig().cmakeName generator = self.getGeneratorFromConfig().cmakeName
if generator.find('Win64') != -1: if generator.find('Win64') != -1:
platform = 'Windows-x64' platform = 'Windows-x64'
@ -1167,7 +1195,7 @@ class InternalCommands:
return path return path
def run_vcbuild(self, generator, mode, args=''): def run_vcbuild(self, generator, mode, solution, args='', dir=''):
import platform import platform
# os_bits should be loaded with '32bit' or '64bit' # os_bits should be loaded with '32bit' or '64bit'
@ -1189,6 +1217,7 @@ class InternalCommands:
else: # target = 32bit else: # target = 32bit
vcvars_platform = 'x86' # 32/64bit OS building 32bit app vcvars_platform = 'x86' # 32/64bit OS building 32bit app
config_platform = 'Win32' config_platform = 'Win32'
if mode == 'release': if mode == 'release':
config = 'Release' config = 'Release'
else: else:
@ -1197,14 +1226,16 @@ class InternalCommands:
if generator.startswith('Visual Studio 10'): if generator.startswith('Visual Studio 10'):
cmd = ('@echo off\n' cmd = ('@echo off\n'
'call "%s" %s \n' 'call "%s" %s \n'
'cd "%s"\n'
'msbuild /nologo %s /p:Configuration="%s" /p:Platform="%s" "%s"' 'msbuild /nologo %s /p:Configuration="%s" /p:Platform="%s" "%s"'
) % (self.get_vcvarsall(generator), vcvars_platform, args, config, config_platform, self.sln_filepath()) ) % (self.get_vcvarsall(generator), vcvars_platform, dir, args, config, config_platform, solution)
else: else:
config = config + '|' + config_platform config = config + '|' + config_platform
cmd = ('@echo off\n' cmd = ('@echo off\n'
'call "%s" %s \n' 'call "%s" %s \n'
'cd "%s"\n'
'vcbuild /nologo %s "%s" "%s"' 'vcbuild /nologo %s "%s" "%s"'
) % (self.get_vcvarsall(generator), vcvars_platform, args, self.sln_filepath(), config) ) % (self.get_vcvarsall(generator), vcvars_platform, dir, args, solution, config)
# Generate a batch file, since we can't use environment variables directly. # Generate a batch file, since we can't use environment variables directly.
temp_bat = self.getBuildDir() + r'\vcbuild.bat' temp_bat = self.getBuildDir() + r'\vcbuild.bat'

BIN
res/banner.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

BIN
res/dialog.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 KiB

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Include>
<?define Name="Synergy" ?>
<?define Author="The Synergy Project" ?>
<?define BinPath="../../../bin/$(var.Configuration)" ?>
<?define ResPath="../../../res" ?>
<?ifndef Version ?>
<?define Version="1.2.3.4" ?>
<?endif?>
<?if $(var.Platform) = "x64" ?>
<?define ProgramFilesFolder="ProgramFiles64Folder" ?>
<?else?>
<?define ProgramFilesFolder="ProgramFilesFolder" ?>
<?endif?>
</Include>

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:fire="http://schemas.microsoft.com/wix/FirewallExtension">
<?include Include.wxi?>
<Product Id="*" Name="$(var.Name)" Language="1033" Version="$(var.Version)" Manufacturer="$(var.Author)" UpgradeCode="E87C85E3-69FD-4F00-BBB4-69C5FD615D47">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<UIRef Id="WixUI_InstallDir" />
<Feature Id="ProductFeature" Title="$(var.Name)">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<Icon Id="synergy.ico" SourceFile="$(var.ResPath)/synergy.ico"/>
<WixVariable Id="WixUILicenseRtf" Value="$(var.ResPath)\License.rtf" />
<WixVariable Id="WixUIBannerBmp" Value="$(var.ResPath)\banner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="$(var.ResPath)\dialog.bmp" />
<Property Id="ARPPRODUCTICON" Value="synergy.ico" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<Property Id="LEGACY_UNINSTALL_EXISTS">
<RegistrySearch
Id="LegacyRegistrySearch" Root="HKLM"
Key="SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Synergy"
Name="UninstallString" Win64="no" Type="file">
<FileSearch Id="LegacyFileSearch" Name="uninstall.exe" />
</RegistrySearch>
</Property>
<Condition Message="An existing installation of [ProductName] was detected, please uninstall it before continuing.">
NOT LEGACY_UNINSTALL_EXISTS
</Condition>
<CustomAction Id="StartGui" FileKey="GuiFile" ExeCommand="" Return="asyncNoWait" />
<InstallExecuteSequence>
<Custom Action="StartGui" After="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.ProgramFilesFolder)">
<Directory Id="INSTALLFOLDER" Name="$(var.Name)" />
</Directory>
<Directory Id="ProgramMenuFolder" />
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="Service" Guid="EC9AD3B0-277C-4157-B5C8-5FD5B6A5F4AD" >
<File Source="$(var.BinPath)/synergyd.exe" />
<ServiceInstall
Id="ServiceInstall" Name="Synergy" DisplayName="[ProductName]"
Description="Controls the [ProductName] foreground processes."
Type="ownProcess" Start="auto" ErrorControl="normal" />
<ServiceControl
Id="ServiceControl" Name="Synergy"
Start="install" Stop="both" Remove="uninstall" />
</Component>
<Component Id="Core" Guid="BBF05BE7-1BC9-444B-8A24-EF35D0B44D39">
<File Source="$(var.BinPath)/synergys.exe">
<fire:FirewallException Id="SereverFirewallException" Name="[ProductName]" Scope="any" />
</File>
<File Source="$(var.BinPath)/synergyc.exe" />
<File Source="$(var.BinPath)/syntool.exe" />
<File Source="$(var.BinPath)/synwinhk.dll" />
</Component>
<Component Id="ShellEx" Guid="77A9CA73-A5A7-4EF9-88CC-F2E014EF73EA">
<File Source="$(var.BinPath)/synwinxt.dll" />
<RegistryKey Root="HKCR" Key="*\shellex\DataHandler">
<RegistryValue Value="{1BE208B1-BC21-4E39-8BB6-A5DC3F51479E}" Type="string" />
</RegistryKey>
<RegistryKey Root="HKCR" Key="CLSID\{1BE208B1-BC21-4E39-8BB6-A5DC3F51479E}\InprocServer32">
<RegistryValue Value="[INSTALLFOLDER]synwinxt.dll" Type="string" />
<RegistryValue Name="ThreadingModel" Value="Apartment" Type="string" />
</RegistryKey>
</Component>
<Component Id="Gui" Guid="BAC8149B-6287-45BF-9C27-43D71ED40214">
<File Id="GuiFile" Source="$(var.BinPath)/synergy.exe" KeyPath="yes">
<Shortcut Id="GuiShortcut" Name="$(var.Name)" Directory="ProgramMenuFolder" Icon="synergy.ico" Advertise="yes" />
</File>
</Component>
</ComponentGroup>
</Fragment>
</Wix>

View File

@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "synergy", "synergy.wixproj", "{D4BA9F39-6A35-4C8F-9CB2-67FCBE5CAB17}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D4BA9F39-6A35-4C8F-9CB2-67FCBE5CAB17}.Debug|x86.ActiveCfg = Debug|x86
{D4BA9F39-6A35-4C8F-9CB2-67FCBE5CAB17}.Debug|x86.Build.0 = Debug|x86
{D4BA9F39-6A35-4C8F-9CB2-67FCBE5CAB17}.Debug|x64.ActiveCfg = Debug|x64
{D4BA9F39-6A35-4C8F-9CB2-67FCBE5CAB17}.Debug|x64.Build.0 = Debug|x64
{D4BA9F39-6A35-4C8F-9CB2-67FCBE5CAB17}.Release|x86.ActiveCfg = Release|x86
{D4BA9F39-6A35-4C8F-9CB2-67FCBE5CAB17}.Release|x86.Build.0 = Release|x86
{D4BA9F39-6A35-4C8F-9CB2-67FCBE5CAB17}.Release|x64.ActiveCfg = Release|x64
{D4BA9F39-6A35-4C8F-9CB2-67FCBE5CAB17}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProductVersion>3.8</ProductVersion>
<ProjectGuid>{d4ba9f39-6a35-4c8f-9cb2-67fcbe5cab17}</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>synergy</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>
<OutputPath>..\..\..\bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>..\..\..\build\wix\obj\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>
<WixExtension Include="WixFirewallExtension">
<HintPath>$(WixExtDir)\WixFirewallExtension.dll</HintPath>
<Name>WixFirewallExtension</Name>
</WixExtension>
<WixExtension Include="WixUtilExtension">
<HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
<Name>WixUtilExtension</Name>
</WixExtension>
<WixExtension Include="WixUIExtension">
<HintPath>C:\Program Files (x86)\WiX Toolset v3.8\bin\WixUIExtension.dll</HintPath>
<Name>WixUIExtension</Name>
</WixExtension>
<Compile Include="Product.wxs" />
<Content Include="Include.wxi" />
</ItemGroup>
<Import Project="$(WixTargetsPath)" />
</Project>