我有一个合并模块,它定义了所有组件/资源,以及安装和启动服务。
这将构建一个在全新安装期间工作的安装程序。从以前的版本升级时,它会在复制所有文件之前尝试启动服务(服务依赖于这些文件)。复制文件后如何让 WiX 启动服务?
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define ComponentRules="OneToOne"?>
<!-- SourceDir instructs IsWiX the location of the directory that contains files for this merge module -->
<?define SourceDir="..\Deploy"?>
<Module Id="AgentMM" Language="1033" Version="1.2.1">
<Package Id="*" Manufacturer="Example Inc" InstallerVersion="500" InstallPrivileges="elevated" InstallScope="perMachine" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="CommonAppDataFolder" Name="CommonAppData">
<Directory Id="owdF4A3A065B05943EB31D4A22FB4A609B2" Name=" ">
<Directory Id="owd054D805088608C669D54B91D1372FB13" Name="agent">
<Component Id="owc054D805088608C669D54B91D1372FB13" Guid="*">
<CreateFolder />
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="MergeRedirectFolder">
<Component Id="owcE4483ACA0E06F6931349C52F4DE32B04" Guid="*">
<File Id="owfE4483ACA0E06F6931349C52F4DE32B04" Source="$(var.SourceDir)\Agent.exe" KeyPath="yes" />
<ServiceInstall Id="si1F414070C0DF7193A1D990B85A956139" Name="Agent" DisplayName="Agent" Description="Reports on system health" ErrorControl="normal" Start="auto" Type="ownProcess" Interactive="no" />
<ServiceControl Id="sc1F414070C0DF7193A1D990B85A956139" Name="Agent" Start="install" Stop="both" Remove="both" Wait="yes" />
</Component>
<Component Id="owcB927FFAE9DA1BF9B833D1BB6615B7D1F" Guid="*">
<File Id="owfB927FFAE9DA1BF9B833D1BB6615B7D1F" Source="$(var.SourceDir)\Cassia.dll" KeyPath="yes" />
</Component>
<Component Id="owc4068B8346D37AA0AFB49DF9E39B8C148" Guid="*">
<File Id="owf4068B8346D37AA0AFB49DF9E39B8C148" Source="$(var.SourceDir)\Cassia.xml" KeyPath="yes" />
</Component>
<Component Id="owc52F75CE3A69F808CE9B7861F5FF157E7" Guid="*">
<File Id="owf52F75CE3A69F808CE9B7861F5FF157E7" Source="$(var.SourceDir)\Agent.exe.config" KeyPath="yes" />
</Component>
<Component Id="owc983DF61596DB6BCFA851E8953561E349" Guid="*">
<File Id="owf983DF61596DB6BCFA851E8953561E349" Source="$(var.SourceDir)\Agent.pdb" KeyPath="yes" />
</Component>
<Component Id="owc2BF30E4776996DDD68B184F69F7D1E00" Guid="*">
<File Id="owf2BF30E4776996DDD68B184F69F7D1E00" Source="$(var.SourceDir)\Utilities.dll" KeyPath="yes" />
</Component>
<Component Id="owcE10E1E5CADEF47AEB294ED17810D9F5D" Guid="*">
<File Id="owfE10E1E5CADEF47AEB294ED17810D9F5D" Source="$(var.SourceDir)\Utilities.pdb" KeyPath="yes" />
</Component>
<Component Id="owcADE9A457248959D397C6B092C7CCF78B" Guid="*">
<File Id="owfADE9A457248959D397C6B092C7CCF78B" Source="$(var.SourceDir)\Microsoft.Win32.Primitives.dll" KeyPath="yes" />
</Component>
<Component Id="owc3FC8434C1A84605AEEBC6A100CA2F3E1" Guid="*">
<File Id="owf3FC8434C1A84605AEEBC6A100CA2F3E1" Source="$(var.SourceDir)\Newtonsoft.Json.dll" KeyPath="yes" />
</Component>
<Component Id="owcDE8FDCCF922CA433A075036DF5C1BE38" Guid="*">
<File Id="owfDE8FDCCF922CA433A075036DF5C1BE38" Source="$(var.SourceDir)\Newtonsoft.Json.xml" KeyPath="yes" />
</Component>
<Component Id="owcBC6AFA6932E46F7635B750194F2DFE30" Guid="*">
<File Id="owfBC6AFA6932E46F7635B750194F2DFE30" Source="$(var.SourceDir)\Nito.AsyncEx.Context.dll" KeyPath="yes" />
</Component>
<Component Id="owcB0247DD3838FC1DDFA9BBA29DDE5A2DB" Guid="*">
<File Id="owfB0247DD3838FC1DDFA9BBA29DDE5A2DB" Source="$(var.SourceDir)\Nito.AsyncEx.Context.xml" KeyPath="yes" />
</Component>
<Component Id="owc80E1432E52AF192AE3A458644EFA81C1" Guid="*">
<File Id="owf80E1432E52AF192AE3A458644EFA81C1" Source="$(var.SourceDir)\Nito.AsyncEx.Tasks.dll" KeyPath="yes" />
</Component>
<Component Id="owc956AF9D61B4B96E805D3B6990EC17870" Guid="*">
<File Id="owf956AF9D61B4B96E805D3B6990EC17870" Source="$(var.SourceDir)\Nito.AsyncEx.Tasks.xml" KeyPath="yes" />
</Component>
<Component Id="owc9797AB99B9AB073F5FAFAE13A51ECE35" Guid="*">
<File Id="owf9797AB99B9AB073F5FAFAE13A51ECE35" Source="$(var.SourceDir)\Nito.Disposables.dll" KeyPath="yes" />
</Component>
<Component Id="owc33EA8A2869C77F471EBAD2451B964902" Guid="*">
<File Id="owf33EA8A2869C77F471EBAD2451B964902" Source="$(var.SourceDir)\Nito.Disposables.xml" KeyPath="yes" />
</Component>
<Component Id="owc25FBE4153F32A5634B0ADA8A6954CC89" Guid="*">
<File Id="owf25FBE4153F32A5634B0ADA8A6954CC89" Source="$(var.SourceDir)\System.AppContext.dll" KeyPath="yes" />
</Component>
<Component Id="owc2F5D24BF1EA2D036DA793146E86BDF87" Guid="*">
<File Id="owf2F5D24BF1EA2D036DA793146E86BDF87" Source="$(var.SourceDir)\System.Collections.Immutable.dll" KeyPath="yes" />
</Component>
<Component Id="owc2BE2107F9B51B79FDB1B19EA807C9C44" Guid="*">
<File Id="owf2BE2107F9B51B79FDB1B19EA807C9C44" Source="$(var.SourceDir)\System.Collections.Immutable.xml" KeyPath="yes" />
</Component>
<Component Id="owcA90D9D10E6DAB6E67011458672887086" Guid="*">
<File Id="owfA90D9D10E6DAB6E67011458672887086" Source="$(var.SourceDir)\System.Console.dll" KeyPath="yes" />
</Component>
<Component Id="owcBC11F886BA2AB9469783C04435BCA0B9" Guid="*">
<File Id="owfBC11F886BA2AB9469783C04435BCA0B9" Source="$(var.SourceDir)\System.Diagnostics.DiagnosticSource.dll" KeyPath="yes" />
</Component>
<Component Id="owc918BEF5091074ABD7E2C05293EDBFE17" Guid="*">
<File Id="owf918BEF5091074ABD7E2C05293EDBFE17" Source="$(var.SourceDir)\System.Diagnostics.DiagnosticSource.xml" KeyPath="yes" />
</Component>
<Component Id="owc38B2B9FCCE93A2C7D2E931C05D695098" Guid="*">
<File Id="owf38B2B9FCCE93A2C7D2E931C05D695098" Source="$(var.SourceDir)\System.Diagnostics.Tracing.dll" KeyPath="yes" />
</Component>
<Component Id="owcB1B1D5CD5E0525947D05C2530DDA9E96" Guid="*">
<File Id="owfB1B1D5CD5E0525947D05C2530DDA9E96" Source="$(var.SourceDir)\System.Globalization.Calendars.dll" KeyPath="yes" />
</Component>
<Component Id="owc5AC6699E38D4EE124CC260C1E19F025A" Guid="">
<File Id="owf5AC6699E38D4EE124CC260C1E19F025A" Source="$(var.SourceDir)\System.IO.Compression.dll" KeyPath="yes" />
</Component>
<Component Id="owc87D8454A10E8D4063130BA0D60AAE450" Guid="*">
<File Id="owf87D8454A10E8D4063130BA0D60AAE450" Source="$(var.SourceDir)\System.IO.Compression.ZipFile.dll" KeyPath="yes" />
</Component>
<Component Id="owc7600C49A56A3819C607969AD7D76A1D1" Guid="*">
<File Id="owf7600C49A56A3819C607969AD7D76A1D1" Source="$(var.SourceDir)\System.IO.dll" KeyPath="yes" />
</Component>
<Component Id="owc6A348A5B38822B45BE742FD5B11ACF09" Guid="*">
<File Id="owf6A348A5B38822B45BE742FD5B11ACF09" Source="$(var.SourceDir)\System.IO.FileSystem.dll" KeyPath="yes" />
</Component>
<Component Id="owc6AF351692769A11F3108B81F1F6AC695" Guid="*">
<File Id="owf6AF351692769A11F3108B81F1F6AC695" Source="$(var.SourceDir)\System.IO.FileSystem.Primitives.dll" KeyPath="yes" />
</Component>
<Component Id="owc14A5BB088914D21BDD2FBEE1395FD78B" Guid="*">
<File Id="owf14A5BB088914D21BDD2FBEE1395FD78B" Source="$(var.SourceDir)\System.Linq.dll" KeyPath="yes" />
</Component>
<Component Id="owc06E33481927840239152432A87297CC9" Guid="*">
<File Id="owf06E33481927840239152432A87297CC9" Source="$(var.SourceDir)\System.Linq.Expressions.dll" KeyPath="yes" />
</Component>
<Component Id="owcB279CD308898A9D5EFCE20D942FB230A" Guid="*">
<File Id="owfB279CD308898A9D5EFCE20D942FB230A" Source="$(var.SourceDir)\System.Net.Http.dll" KeyPath="yes" />
</Component>
<Component Id="owcE7C4094F57B0A8D61E66E0978388F384" Guid="*">
<File Id="owfE7C4094F57B0A8D61E66E0978388F384" Source="$(var.SourceDir)\System.Net.Http.Formatting.dll" KeyPath="yes" />
</Component>
<Component Id="owcAB556DAB8513CFEB9A95F8187FBB7D96" Guid="*">
<File Id="owfAB556DAB8513CFEB9A95F8187FBB7D96" Source="$(var.SourceDir)\System.Net.Http.Formatting.xml" KeyPath="yes" />
</Component>
<Component Id="owcC356900D1A9E2893A31E87C428F0E41B" Guid="*">
<File Id="owfC356900D1A9E2893A31E87C428F0E41B" Source="$(var.SourceDir)\System.Net.Sockets.dll" KeyPath="yes" />
</Component>
<Component Id="owc7A6EE41CC1504CC124313BD05EDA4F44" Guid="*">
<File Id="owf7A6EE41CC1504CC124313BD05EDA4F44" Source="$(var.SourceDir)\System.Reflection.dll" KeyPath="yes" />
</Component>
<Component Id="owcCD2580ECA1FA1A3513916545D2F2BFA5" Guid="*">
<File Id="owfCD2580ECA1FA1A3513916545D2F2BFA5" Source="$(var.SourceDir)\System.Runtime.dll" KeyPath="yes" />
</Component>
<Component Id="owcB0183318DD63CCAB717750C767DC21D7" Guid="*">
<File Id="owfB0183318DD63CCAB717750C767DC21D7" Source="$(var.SourceDir)\System.Runtime.Extensions.dll" KeyPath="yes" />
</Component>
<Component Id="owc456C772F6BA4F8274FFF4540362C5A62" Guid="*">
<File Id="owf456C772F6BA4F8274FFF4540362C5A62" Source="$(var.SourceDir)\System.Runtime.InteropServices.dll" KeyPath="yes" />
</Component>
<Component Id="owc142B759C8549F55E22EAD18CF214B77E" Guid="*">
<File Id="owf142B759C8549F55E22EAD18CF214B77E" Source="$(var.SourceDir)\System.Runtime.InteropServices.RuntimeInformation.dll" KeyPath="yes" />
</Component>
<Component Id="owcD6CB46E32249D9DFE253203C9E68622F" Guid="*">
<File Id="owfD6CB46E32249D9DFE253203C9E68622F" Source="$(var.SourceDir)\System.Security.Cryptography.Algorithms.dll" KeyPath="yes" />
</Component>
<Component Id="owcF620F5D5E0DED6F51741DE9E09BAA10C" Guid="*">
<File Id="owfF620F5D5E0DED6F51741DE9E09BAA10C" Source="$(var.SourceDir)\System.Security.Cryptography.Encoding.dll" KeyPath="yes" />
</Component>
<Component Id="owc0F0B6DF93E003C893A5E5E253BAF6C85" Guid="*">
<File Id="owf0F0B6DF93E003C893A5E5E253BAF6C85" Source="$(var.SourceDir)\System.Security.Cryptography.Primitives.dll" KeyPath="yes" />
</Component>
<Component Id="owc328828932DA40CAED6EC4EA121F7534D" Guid="*">
<File Id="owf328828932DA40CAED6EC4EA121F7534D" Source="$(var.SourceDir)\System.Security.Cryptography.X509Certificates.dll" KeyPath="yes" />
</Component>
<Component Id="owc50D709F95681A7937E1395ED21E4DE32" Guid="*">
<File Id="owf50D709F95681A7937E1395ED21E4DE32" Source="$(var.SourceDir)\System.Text.RegularExpressions.dll" KeyPath="yes" />
</Component>
<Component Id="owc1EC9EF9564C76F0DA10AA382F306146E" Guid="*">
<File Id="owf1EC9EF9564C76F0DA10AA382F306146E" Source="$(var.SourceDir)\System.Xml.ReaderWriter.dll" KeyPath="yes" />
</Component>
</Directory>
</Directory>
<ComponentGroupRef Id="Custom" />
</Module>
</Wix>