Skip to content

Commit

Permalink
Fix installer dep error
Browse files Browse the repository at this point in the history
  • Loading branch information
koho committed Aug 31, 2020
1 parent 95c3a68 commit a571f1a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
3 changes: 2 additions & 1 deletion build.cmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@echo off
set GIN_MODE=release
go build -o bin/svcctl.exe svcctl
call installer/build.cmd
call installer/build.cmd 1.0.2
cd ..
Binary file added installer/Microsoft_VC141_CRT_x64.msm
Binary file not shown.
14 changes: 9 additions & 5 deletions installer/build.cmd
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
@echo off
set SVCCTL_VERSION=1.0.1
set SVCCTL_VERSION=%1
set BUILDDIR=%~dp0
cd /d %BUILDDIR% || exit /b 1
if not exist %BUILDDIR%\build MD %BUILDDIR%\build
call VsDevCmd.bat
if "%WIX%"=="" (
echo ERROR: WIX was not found.
exit /b 1
)
if not exist build md build
call vcvarsall.bat amd64
set SDK_PLATFORM=VS2017
cl /Zc:wchar_t /D "_UNICODE" /D "UNICODE" /nologo /O2 /W3 /GL /DNDEBUG /MD "-I%WIX%sdk\%SDK_PLATFORM%\inc" actions.cpp /Fo.\build\ /link /LTCG /NOLOGO "/LIBPATH:%WIX%sdk\%SDK_PLATFORM%\lib\x86" msi.lib wcautil.lib dutil.lib kernel32.lib user32.lib advapi32.lib Version.lib shell32.lib /DLL /DEF:"actions.def" /IMPLIB:.\build\actions.lib /OUT:.\build\actions.dll || exit /b 1
cl /Zc:wchar_t /D "_UNICODE" /D "UNICODE" /nologo /O2 /W3 /GL /DNDEBUG /MD "-I%WIX%sdk\%SDK_PLATFORM%\inc" actions.cpp /Fo.\build\ /link /LTCG /NOLOGO "/LIBPATH:%WIX%sdk\%SDK_PLATFORM%\lib\x64" msi.lib wcautil.lib dutil.lib kernel32.lib user32.lib advapi32.lib Version.lib shell32.lib /DLL /DEF:"actions.def" /IMPLIB:.\build\actions.lib /OUT:.\build\actions.dll || exit /b 1
set WIX_CANDLE_FLAGS=-nologo -dSVCCTL_VERSION=%SVCCTL_VERSION%
set WIX_LIGHT_FLAGS=-nologo -spdb -ext "%WIX%bin\\WixUtilExtension.dll" -ext "%WIX%bin\\WixUIExtension.dll" -cultures:zh-CN
"%WIX%bin\candle" %WIX_CANDLE_FLAGS% -out build\ -arch x86 svcctl.wxs
"%WIX%bin\candle" %WIX_CANDLE_FLAGS% -out build\ -arch x64 svcctl.wxs
"%WIX%bin\light" %WIX_LIGHT_FLAGS% -out "..\\bin\\svcctl-%SVCCTL_VERSION%.msi" "build\\svcctl.wixobj"
12 changes: 9 additions & 3 deletions installer/svcctl.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Service Controller" Language="2052" Version="$(var.SVCCTL_VERSION)" Manufacturer="Service Controller" UpgradeCode="DBDB8AA7-EE15-4360-A52F-99928FBA9D12" Codepage="936">

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

<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
Expand Down Expand Up @@ -39,11 +39,17 @@
<InstallExecuteSequence>
<Custom Action="KillProcesses" Before="InstallInitialize">REMOVE="ALL"</Custom>
</InstallExecuteSequence>
<DirectoryRef Id="TARGETDIR">
<Merge Id="VCRedist" SourceFile="Microsoft_VC141_CRT_x64.msm" DiskId="1" Language="0"/>
</DirectoryRef>
<Feature Id="VCRedist" Title="Visual C++ 14.1 Runtime" AllowAdvertise="no" Display="hidden" Level="1">
<MergeRef Id="VCRedist"/>
</Feature>
</Product>

<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="Service Controller" />
</Directory>
<Directory Id="ProgramMenuFolder">
Expand All @@ -53,7 +59,7 @@

<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Guid="{5E369341-4051-4BD3-AB1A-ED7D7B21F784}" Id="MainApplication">
<Component Guid="{5E369341-4051-4BD3-AB1A-ED7D7B21F784}" Id="MainApplication" Win64="yes">
<File Id="MainApplication" Source="..\\bin\\svcctl.exe" KeyPath="yes">
</File>
<ServiceControl Id="DummyService.721AC108_A84C_44FC_ADBD_3295ED294C7D" Name="DummyService.721AC108_A84C_44FC_ADBD_3295ED294C7D" />
Expand Down

0 comments on commit a571f1a

Please sign in to comment.