所以我使用Net Core 2.2进行了一项服务(并部署了它的某些MSI版本( 1.3 )),只是看到它的支持已经结束,所以我将该应用程序降级为最新的2.1。 lts版本并制作了新版本 1.4 。
现在的问题是,MSI在升级时会忽略某些较旧版本的dll,这会导致升级后出现一些随机丢失的dll,并且服务未运行。 应该是400个文件,但大约为250
当我手动卸载旧版本并安装新版本时,一切都按预期工作。
所以我认为,当msi在执行更新工作之前先清除二进制文件夹,这样无论如何每次“更新”都是干净的安装,总的来说会更好。
我尝试过
RemoveFolderEx
RemoveExistingProducts
但是每次升级时都会丢失一些dll。
我将不胜感激。
下面是我的wxs。 (我切断了大约400个自包含的dll)
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="*" Name="Company Service" Language="1033" Version="1.4.0.0" Manufacturer="mycompany" UpgradeCode="298d3b82-3c3b-4315-bfdc-9e54c873eae6">
<Package InstallerVersion="300" Compressed="yes" InstallScope="perMachine" Platform="x64"/>
<MajorUpgrade Schedule="afterInstallInitialize"
DowngradeErrorMessage="A newer version of [ProductName] is already installed."/>
<MediaTemplate EmbedCab="yes" />
<!--<InstallExecuteSequence>
<RemoveExistingProducts After="InstallInitialize"/>
</InstallExecuteSequence>-->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="CommonAppDataFolder">
<Directory Id ="CommonAppDataManufacturerFolder" Name="Company">
<Directory Id="ServicesFolder" Name="Services">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="Service">
<Directory Id="APPLICATIONBINDIRECTORY" Name="bin">
<Component Id='APPLICATIONBINDIRECTORY' Guid='f0342819-30f9-4595-9e09-0ed6a77729b4' Win64="yes">
<CreateFolder/>
<util:RemoveFolderEx Id='REMOVEAPPLICATIONBINDIRECTORY' Property='BINDIRECTORYPROPERTY' On='both' />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
<Property Id='BINDIRECTORYPROPERTY' Secure='yes' Value='C:\ProgramData\Company\Services\Service\bin'></Property>
<!-- Step 2: Add files to your installer package -->
<DirectoryRef Id="APPLICATIONBINDIRECTORY">
<Component Id="Service.exe" Win64="yes">
<File Id="Service.exe" Source="C:\Service\bin\Release\netcoreapp2.1\win-x64\publish\Service.exe" KeyPath="yes"/>
<ServiceInstall Id="CompanyServiceInstaller" Account="LocalSystem" Name="CompanyService" DisplayName="Company Service"
ErrorControl="ignore" Interactive="no" Start="auto" Type="ownProcess" Vital="yes" >
</ServiceInstall>
<ServiceControl Id="StartCompanyService" Name="CompanyService" Start="install" Wait="no" ></ServiceControl>
<ServiceControl Id="StopCompanyService" Name="CompanyService" Stop="both" Remove="uninstall" Wait ="yes" ></ServiceControl>
<RegistryKey Root='HKLM' Key='Software\mycompany\Services\CompanySERVICE' Action='createAndRemoveOnUninstall'>
<RegistryValue Type='string' Name='Version' Value='1.10.0.0' ></RegistryValue>
</RegistryKey>
</Component>
<Component Id="comp6a32f759_2ed3_4a84_9984_d1e77404a7fd" Win64="yes">
<File Id="file2c99c118_9c3b_4ce8_b07b_b08104954efe" Source="C:\Service\bin\Release\netcoreapp2.1\win-x64\publish\some.dll"/>
</Component>
</DirectoryRef>
<!-- Step 3: Tell WiX to install the files -->
<Feature Id="_Service_Service" Title="Service" Level="1" >
<ComponentRef Id="Service.exe"/>
<ComponentRef Id="APPLICATIONBINDIRECTORY"/>
<ComponentRef Id="comp6a32f759_2ed3_4a84_9984_d1e77404a7fd" />
</Feature>
</Product>
</Wix>