我已经搜索了好几个小时但没有找到任何解决方案的问题。
我使用的是Wix 3.14,每次在构建服务器上进行构建时,都会出现此错误。当我在计算机上进行本地构建时,它每次都可以运行,但是永远无法在构建服务器上运行。
我先生成一个msi文件,然后将另一个安装包与安装可执行文件捆绑在一起。
2019-01-31T10:25:46.2328162Z Moving file 'D:\agent\_work\_temp\1jjhaplm\1jjhaplm\setup-bundle.exe' to 'D:\agent\_work\18\a\dist\setup-bundle.exe'.
2019-01-31T10:25:51.2172314Z light.exe : error LGHT0001 : The process cannot access the file because it is being used by another process.
这是我构建软件包的方式:
heat dir ./source -var var.SourceDir -cg MainComponentGroup -platform=x64 -dr INSTALLLOCATION -sreg -gg -o files.wxs
candle -arch x64 -dSourceDir=source -ext WixUtilExtension -ext WixUIExtension ambr.wxs files.wxs
light -ext WixUtilExtension -ext WixUIExtension ambr.wixobj files.wixobj -o setup.msi
candle -arch x64 -dSourceDir=source -ext WixUtilExtension -ext WixUIExtension -ext WixBalExtension Bundle.wxs
light -v -ext WixUtilExtension -ext WixUIExtension -ext WixBalExtension Bundle.wixobj -o setup-bundle.exe
bundle.wxs文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:vi="http://schemas.visualinstaller.de/VisualInstallerWixExtension">
<?define UmRes="..\setup-utils\"?>
<?define UmVersionInfoMajor="1"?>
<?define UmVersionInfoMinor="0"?>
<?define UmVersionInfoRevision="0"?>
<?define PlatformGuidPart="BB64"?>
<?define GUID_BundleProduct="{206E1EC4-3377-$(var.UmVersionInfoMajor)$(var.UmVersionInfoMinor)$(var.UmVersionInfoRevision)0-$(var.PlatformGuidPart)-000F000F1337}" ?>
<?define Platform="x64"?>
<?define Configuration="release"?>
<?define UmCompilerVersion="vc140"?>
<?define OutDir="."?>
<?define UmProduct="The product"?>
<?include CommonIncludes.wxi ?>
<!-- Add minor version to some strings if the minor version is != 0. -->
<?if $(var.UmVersionInfoMinor) = "0" ?>
<!-- The format of the product name in GUI -->
<?define UmProd-display="$(var.UmProduct) $(var.UmVersionInfoMajor)" ?>
<!-- The format for the version number in the setup program. -->
<?define UmSetupVersion="$(var.UmVersionInfoMajor)"?>
<?else ?>
<?define UmProd-display="$(var.UmProduct) $(var.UmVersionInfoMajor).$(var.UmVersionInfoMinor)" ?>
<?if $(var.UmVersionInfoRevision) = "0" ?>
<?define UmSetupVersion="$(var.UmVersionInfoMajor)_$(var.UmVersionInfoMinor)"?>
<?else ?>
<?define UmSetupVersion="$(var.UmVersionInfoMajor)_$(var.UmVersionInfoMinor)_$(var.UmVersionInfoRevision)"?>
<?endif ?>
<?endif ?>
<?define UmSetupName="$(var.UmSuiteName) $(var.UmProduct)" ?>
<?define UmProductVersion="$(var.UmVersionInfoMajor).$(var.UmVersionInfoMinor).$(var.UmVersionInfoRevision).$(var.UmVersionInfoBuild)" ?>
<?define MongoDBMSI="mongodb-win32-x86_64-2008plus-ssl-3.6.9-signed.msi" ?>
<?define VCRedistSetup="VC_redist.x64.exe" ?>
<?define AMBRMSI="setup.msi" ?>
<Bundle Name="$(var.UmSetupName)" Version="$(var.UmVersionInfoMajor).$(var.UmVersionInfoMinor).$(var.UmVersionInfoRevision).$(var.UmVersionInfoBuild)"
Manufacturer="$(var.UmLegalName)"
UpgradeCode="$(var.GUID_BundleProduct)"
>
<!--<Update Location="http://test.laika42.com/UpdateInfo.xml"/>-->
<!-- Payload, that has to be added to run the boostrapper application -->
<!-- <BootstrapperApplicationRef Id='ManagedBootstrapperApplicationHost'>
<PayloadGroupRef Id='VisualInstallerRuntimeFiles'/>
</BootstrapperApplicationRef> -->
<Variable Name="INSTALLDIR" bal:Overridable='no' Value='[$(var.UmProgramFilesFolder)]$(var.UmSuiteName)\$(var.UmProd-display)'/>
<Variable Name="MONGODBINSTALLDIR" bal:Overridable='yes' Value='[$(var.UmProgramFilesFolder)]\MongoDB\Server\3.6'/>
<Variable Name="PRODUCTVERSION" bal:Overridable='no' Value='$(var.UmProductVersion)'/>
<Variable Name="PRODUCTNAME" bal:Overridable='no' Value='$(var.UmProduct)'/>
<Variable Name="ADDLOCAL" Type="string" Value="all" Persisted="yes" bal:Overridable='yes'/>
<BootstrapperApplicationRef Id='WixStandardBootstrapperApplication.RtfLicense'>
<bal:WixStandardBootstrapperApplication
LicenseFile="General License Terms.rtf"
/>
</BootstrapperApplicationRef>
<Log/>
<Chain>
<PackageGroupRef Id="redist_vc140" />
<MsiPackage SourceFile='$(var.MongoDBMSI)' Compressed="yes" >
<MsiProperty Name='INSTALLLOCATION' Value='[MONGODBINSTALLDIR]'/>
<MsiProperty Name='SHOULD_INSTALL_COMPASS' Value='0'/>
</MsiPackage>
<MsiPackage SourceFile='$(var.AMBRMSI)'/>
</Chain>
</Bundle>
<!-- Microsoft Visual C++ Redistributable for Visual Studio 2017 -->
<!-- https://docs.microsoft.com/en-us/cpp/ide/redistributing-visual-cpp-files?view=vs-2017 -->
<Fragment>
<util:RegistrySearch Id="VCRedist"
Root="HKLM"
Key="SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\$(var.Platform)"
Value="Version"
Variable="VCRedistVersion"
/>
<!-- the result in VCRedistVersion looks like this: v14.16.27012.00 -->
<PackageGroup Id="redist_vc140">
<ExePackage Id="vc140" Cache="yes" PerMachine="yes" Permanent="yes" Vital="yes" Compressed="yes"
SourceFile="$(var.VCRedistSetup)"
Name="VC_redist.$(var.Platform).exe"
InstallCommand="/install /quiet /norestart"
InstallCondition="(NOT VCRedistVersion >= v14.16.27012.00) OR NOT VCRedistVersion"
/>
<!-- NOTE: When Visual Studio is updated with a new version of the bundled redist, the above path will no longer be correct, resulting in a build error.
That is a trigger for you, the developer, to update the version number both in SourceFile, and in InstallCondition -->
</PackageGroup>
</Fragment>
</Wix>
如何解决此问题或找出问题所在?