Visual studio 2017 如何让WiX项目获取可执行文件
我在构建的VS2017项目中遇到了一个问题。由于某些原因,WiX项目无法定位可执行文件和相关文件。我收到以下错误消息: 系统找不到文件“…\Bin\Debug\psAlertScheduleServer.exe” 我已经检查过了,文件psalertscheduleserver.exe肯定在指定的相对文件夹中 多年来,我使用了一种定义变量的技术,成功地为许多不同的项目保存了WiX项目中可执行文件的位置,但是这一个是“逆势而行的” 我正在使用WIX3.11。以下是项目的product.wsx文件:Visual studio 2017 如何让WiX项目获取可执行文件,visual-studio-2017,wix,Visual Studio 2017,Wix,我在构建的VS2017项目中遇到了一个问题。由于某些原因,WiX项目无法定位可执行文件和相关文件。我收到以下错误消息: 系统找不到文件“…\Bin\Debug\psAlertScheduleServer.exe” 我已经检查过了,文件psalertscheduleserver.exe肯定在指定的相对文件夹中 多年来,我使用了一种定义变量的技术,成功地为许多不同的项目保存了WiX项目中可执行文件的位置,但是这一个是“逆势而行的” 我正在使用WIX3.11。以下是项目的product.wsx文件:
<?xml version="1.0" encoding="UTF-8"?>
<?define SourceDir = "..\..\..\Bin\Debug" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="*" Name="PSALERTSScheduleServerProduct" Language="1033" Version="5.3.0.8" Manufacturer="SP Energy Networks" UpgradeCode="a3baddfc-0965-47ed-a30f-be5eae7bc2df">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="PSALERTS ScheduleServer 2018" Level="1">
<ComponentRef Id="cmpDirScheduleServer" />
<ComponentRef Id="cmpScheduleServerExe" />
<ComponentRef Id="cmpScheduleServerPdb" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="PSALERTSScheduleServerProduct" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<!-- The following section deals with the deployment of the program, config and related data files-->
<Directory Id="ProgramFilesFolder">
<Directory Id="dirSPEnergyNetworks" Name="SP Energy Networks">
<Directory Id="dirPSALERTS" Name="PSALERTS">
<Directory Id="dirScheduleServer" Name="PSALERTS Schedule Server">
<Component Id="cmpDirScheduleServer" Guid="{a valid guid}" KeyPath="yes">
<CreateFolder Directory="dirScheduleServer" />
<RemoveFile Id="PurgeScheduleServer" Name="*.*" On="uninstall" />
<RemoveFolder Id="idDirScheduleServer" On="uninstall" Directory="dirScheduleServer" />
</Component>
<Component Id="cmpScheduleServerExe" Guid="{a valid guid}">
<File Id="filScheduleServerExe"
KeyPath="yes"
Source="$(var.SourceDir)\PSALERTSScheduleServer.exe"
/>
<ServiceInstall Id="cmpScheduleServerExe"
Type="ownProcess"
Name="psaschdsrvr2018"
DisplayName="PSALERTS Schedule Server 2018"
Description="For automatic generation and delivery of PSALERTS reports."
Start="demand"
Account="LocalSystem"
ErrorControl="normal">
<util:PermissionEx
User="Everyone"
ServicePauseContinue="yes"
ServiceQueryStatus="yes"
ServiceStart="yes"
ServiceStop="yes"
ServiceUserDefinedControl="yes"
/>
</ServiceInstall>
<!-- <ServiceControl
Id="cmpScheduleServerExe"
Start="install" Stop="both"
Remove="uninstall"
Name="psaschdsrvr2018"
Wait="yes"
/>-->
<RemoveRegistryKey Id="RemoveScheduleServerRegKey" Root="HKLM" Key="SOFTWARE\SP Energy Networks\PSALERTS\Schedule Server" Action="removeOnUninstall" />
</Component>
<Component Id="cmpScheduleServerPdb" Guid="{a valid guid}">
<File Id="filScheduleServerPdb" KeyPath="yes" Source="$(var.SourceDir)\PSALERTSScheduleServer.pdb" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
注意:我已经用文字路径替换了相对路径引用,但它仍然不起作用。现在不能看这个,但我会注释掉所有内容并添加回一个文件,将路径硬编码为绝对路径(C:\Full path Here\file.exe),只是为了获得心跳编译-我想这有点明显。我只是想确认没有其他错误。我在这里做了一些奇怪的事情,我不太记得我在做什么:-)-但也许看看:和相关的。$(sys.SOURCEFILEDIR)应该为您提供WiX源文件所在的文件夹。为什么我不只是使用相对路径?这是有原因的——我不记得了。我将使用SourceDir以外的其他内容,例如:$(var.MyReleasePath)。对不起,这是一个混乱的“垃圾邮件”。我只是想给你一些链接,以防没有其他人回答。注意:我已经用文字路径替换了相对路径引用,但它仍然不起作用。现在无法查看,但我会注释掉所有内容并添加回一个文件,将路径硬编码为绝对路径(C:\Full path Here\file.exe)只是为了得到心跳-我想这是很明显的。我只是想确认没有其他错误。我在这里做了一些奇怪的事情,我不太记得我在做什么:-)-但也许看看:和相关的。$(sys.SOURCEFILEDIR)应该为您提供WiX源文件所在的文件夹。为什么我不只是使用相对路径?这是有原因的——我不记得了。我将使用SourceDir以外的其他内容,例如:$(var.MyReleasePath)。对不起,这是一个混乱的“垃圾邮件”。只是想给你一些链接,以防没有其他人回答。