Tôi đang sử dụng HeatDirectory để tạo tệp .wxs nguồn. Trong thư mục pickup có một exe cần được cài đặt như dịch vụ. Trên thực tế tôi biết làm thế nào để cài đặt dịch vụ nếu tôi tạo thành phần bản thân mình, nhưng tôi không biết làm thế nào để bao gồm ServiceInstall trong thành phần tự động tạo ra. Có gợi ý nào không?wix HeatDirectory ServiceInstall
<HeatDirectory DirectoryRefId="Guardian" OutputFile="Source\GuardianSource.wxs" Transforms="Filter.xsl" Directory="..\Setup\C24.Guardian\bin\Debug" PreprocessorVariable="var.GuardianPath" ComponentGroupName="GuardianGroup" ToolPath="$(WixToolPath)" SuppressCom="true" SuppressFragments="true" SuppressRegistry="true" SuppressRootDirectory="true" AutoGenerateGuids="true" GenerateGuidsNow="false">
</HeatDirectory>
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="Guardian">
<Component Id="cmp70BEDA00F3161F3FB5E847EB1136B1D5" Guid="*">
<File Id="fil26DCBF1E4218C7363018FBA2CD456633" KeyPath="yes" Source="$(var.GuardianPath)\C24.Guardian.exe" />
</Component>
<Component Id="cmp2EE8126A193FA022ED35FAD8F182E65A" Guid="*">
<File Id="fil785CD681C496EDDAB457E8314C49D686" KeyPath="yes" Source="$(var.GuardianPath)\C24.Guardian.exe.config" />
</Component>
<Component Id="cmp0CC91B457FBC44F978A2AD6B24043DCF" Guid="*">
<File Id="fil2D304D0395599AAAAAF975A2DBFD530F" KeyPath="yes" Source="$(var.GuardianPath)\C24.Guardian.pdb" />
</Component>
<Component Id="cmpFB799FA015274DDBE2C337C60667D2C5" Guid="*">
<File Id="filB9C39B394CAD03F5A1BC3262C61EDDEB" KeyPath="yes" Source="$(var.GuardianPath)\C24.Guardian.vshost.exe" />
</Component>
<Component Id="cmp28C29865AE85B067BCEEBD70EFDB19D5" Guid="*">
<File Id="fil0A756B711769AAD657F306B3A6EA7134" KeyPath="yes" Source="$(var.GuardianPath)\C24.Guardian.vshost.exe.config" />
</Component>
<Component Id="cmp92A715A4BD4B580A6E70362230170428" Guid="*">
<File Id="filBD9D504F303A6EEC9E340E3872BBB0AE" KeyPath="yes" Source="$(var.GuardianPath)\C24.Guardian.vshost.exe.manifest" />
</Component>
<Component Id="cmp8AB6A241FA2D13F296CBD946C9711579" Guid="*">
<File Id="fil8EF8CC607CB82B32F84FC9EC2F1636B9" KeyPath="yes" Source="$(var.GuardianPath)\com.Contact24.Tools.dll" />
</Component>
<Component Id="cmpC0DBB85C89E8AEA9BAC6E32B85913A2C" Guid="*">
<File Id="fil917CD649C5C318C6717D8EA9FFDF911A" KeyPath="yes" Source="$(var.GuardianPath)\com.Contact24.Tools.pdb" />
</Component>
<Component Id="cmp8AFB0FC7CCF571B61196D9166DEEBA24" Guid="*">
<File Id="fil32C12DF0163D5BAD7D0495F2CA2C8DA1" KeyPath="yes" Source="$(var.GuardianPath)\ICSharpCode.SharpZipLib.dll" />
</Component>
<Component Id="cmpF5DE5EB2B4C6E33F0C32CFF5F464432C" Guid="*">
<File Id="fil3C8C6F29095A04034E72FBB187F8B841" KeyPath="yes" Source="$(var.GuardianPath)\log4net.dll" />
</Component>
<Component Id="cmp27A7791E229DDDBC065069B26138FC2F" Guid="*">
<File Id="fil8DED592D9F63E708FEF848D2980A5186" KeyPath="yes" Source="$(var.GuardianPath)\log4net.xml" />
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="GuardianGroup">
<ComponentRef Id="cmp70BEDA00F3161F3FB5E847EB1136B1D5" />
<ComponentRef Id="cmp2EE8126A193FA022ED35FAD8F182E65A" />
<ComponentRef Id="cmp0CC91B457FBC44F978A2AD6B24043DCF" />
<ComponentRef Id="cmpFB799FA015274DDBE2C337C60667D2C5" />
<ComponentRef Id="cmp28C29865AE85B067BCEEBD70EFDB19D5" />
<ComponentRef Id="cmp92A715A4BD4B580A6E70362230170428" />
<ComponentRef Id="cmp8AB6A241FA2D13F296CBD946C9711579" />
<ComponentRef Id="cmpC0DBB85C89E8AEA9BAC6E32B85913A2C" />
<ComponentRef Id="cmp8AFB0FC7CCF571B61196D9166DEEBA24" />
<ComponentRef Id="cmpF5DE5EB2B4C6E33F0C32CFF5F464432C" />
<ComponentRef Id="cmp27A7791E229DDDBC065069B26138FC2F" />
</ComponentGroup>
</Fragment>
</Wix>
Nó sẽ được tốt để có được một cái gì đó giống như các mã tự động sau tạo:
<ComponentRef Id="cmp70BEDA00F3161F3FB5E847EB1136B1D5">
<ServiceInstall
Id="ServiceAdminGuardianInstaller"
Type="ownProcess"
Vital="yes"
Name="C24.Guardian"
DisplayName="C24.Guardian"
Description="Служба контроля работы сервера администрирования"
Start="auto"
Account="[SERVICEACCOUNT]"
Password="[SERVICEPASSWORD]"
ErrorControl="ignore"
Interactive="no">
<util:PermissionEx
User="Everyone"
GenericAll="yes"
ServiceChangeConfig="yes"
ServiceEnumerateDependents="yes"
ChangePermission="yes"
ServiceInterrogate="yes"
ServicePauseContinue="yes"
ServiceQueryConfig="yes"
ServiceQueryStatus="yes"
ServiceStart="yes"
ServiceStop="yes"/>
</ServiceInstall>
<ServiceControl Id="StopGuardianService" Name="C24.Guardian" Stop="both" Wait="yes" Remove="uninstall" />
</ComponentRef>
Giải pháp gọn gàng! Thật không may [biến không được phép] (trong http://stackoverflow.com/a/8839952/1811525) trong biểu thức khớp, mà sẽ có ích để khớp với tên của tệp thực thi đầy đủ mà không cần mã hóa cứng nó trong định nghĩa chuyển đổi. :-( – CodeFox
Tôi thích giải pháp của sttaq vì nó rất hữu ích nếu bạn đang chuyển đổi số tệp wxs, bằng cách truyền tham số. –