我一直在寻找解决这个问题的方法,但没有任何运气,所以我在这里问。
我有一个Wix3.11MSI安装程序来安装我的应用程序。我的应用程序有多个特性--应用程序(.NET Core )、数据库(PostgreSQL 12)、文档(PDF)。当有更新时,99%的时间只是应用程序中的更新。但是,如果用户在每次更新中重新安装所有功能,数据库中的松散数据就会被删除并再次创建。
是否有一种方法只影响在小/主要升级上选择的特性,还是我完全搞错了?
下面是我的Product.wxs的样子(我删除了变量并替换了GUID):
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="$(var.ProductCode)" Name="$(var.AppDisplayName) $(var.bitness)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)" Version="$(var.Version)" Language="1033">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Manufacturer="$(var.Manufacturer)" />
<UIRef Id="WixUI_FeatureTree" />
<UIRef Id="WixUI_ErrorProgressText" />
<Condition Message="!(loc.YouNeedToBeAdmin)">
Privileged
</Condition>
<Media Id="1" Cabinet="$(var.CabName)" EmbedCab="yes" />
<MajorUpgrade DowngradeErrorMessage="!(loc.NewerVersionAlreadyInstalled)"
AllowSameVersionUpgrades="yes"/>
<Feature Id="Complete" Title="!(loc.FeatureComplete)" Level="1" Description="!(loc.FeatureComplete)" Display="expand" ConfigurableDirectory="INSTALLFOLDER" AllowAdvertise="no" InstallDefault="local" TypicalDefault="install" Absent="disallow">
<!--MAIN APP FEATURE-->
<Feature Id="MainApplication" Title="!(loc.FeatureMainApplication)" Level="1" Description="!(loc.FeatureMainApplication)" TypicalDefault="install" AllowAdvertise="no" InstallDefault="local" Absent="disallow">
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="ApplicationShortcutDesktop" />
<ComponentGroupRef Id="MainApplicationComponents" />
</Feature>
<!--DATABASE FILES FEATURE-->
<Feature Id="Database" Title="!(loc.FeatureDatabase)" Level="1" Description="!(loc.FeatureDatabase)" TypicalDefault="install" AllowAdvertise="no" InstallDefault="local" Absent="allow">
<ComponentGroupRef Id="PostgreModule" />
</Feature>
<!--DOCUMENTATION FEATURE-->
<Feature Id="Documentation" Title="!(loc.FeatureDocumentation)" Level="1" Description="!(loc.FeatureDocumentation)" TypicalDefault="install" AllowAdvertise="no" InstallDefault="local" Absent="allow">
<ComponentGroupRef Id="Documentation" />
</Feature>
</Feature>
<!--PostgreSQL Custom Actions calling bat files-->
<CustomAction Id="PostgreSQLCreator"
FileKey="createPostgreSQL.bat" Execute="deferred" Return="check" Impersonate="no"/>
<CustomAction Id="PostgreSQLDestroyer"
FileKey="deletePostgreSQL.bat" Execute="deferred" Return="check" Impersonate="no"/>
<InstallExecuteSequence>
<Custom Action="PostgreSQLCreator" After="InstallFiles">
<![CDATA[(&Database=3) AND NOT(!Database=3)]]>
</Custom>
<Custom Action="PostgreSQLDestroyer" Before="RemoveFiles">
<![CDATA[(&Database=2) AND (!Database=3)]]>
</Custom>
</InstallExecuteSequence>
</Product>
<!--CREATING DIRECTORIES-->
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="PlatformProgramFilesFolder">
<Directory Id="ROOTDIRECTORY" Name="$(var.Manufacturer)">
<Directory Id="INSTALLFOLDER" Name="$(var.AppFolderName)">
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="$(var.AppDisplayName)"/>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop"/>
<Directory Id="CommonAppDataFolder">
<Directory Id="ApplicationProgramDataFolder" Name="$(var.AppFolderName)">
<Directory Id="ApplicationDatabaseFolder" Name="PostgreSQL" />
</Directory>
</Directory>
</Directory>
</Fragment>
<!--MAIN APP EXE-->
<Fragment>
<ComponentGroup Id="MainApplicationComponents" Directory="INSTALLFOLDER">
<Component Id="AdremWpf" Guid="SOME-GUID-HERE" >
<File Source="$(var.AppSingleExePath)" />
</Component>
</ComponentGroup>
</Fragment>
<!--MANUAL PDF-->
<Fragment>
<ComponentGroup Id="Documentation" Directory="INSTALLFOLDER">
<Component Id="ReferenceManual" Guid="SOME-GUID-HERE">
<File Id='Manual' Name='Manual.pdf' Source='Manual.pdf' KeyPath='yes'>
<Shortcut Id='StartmenuManual' Directory='DesktopFolder' Name='My Manual' Advertise='yes' />
</File>
</Component>
</ComponentGroup>
</Fragment>
<!--SHORTCUTS-->
<Fragment>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="SOME-GUID-HERE">
<Shortcut Id="ApplicationStartMenuShortcut" Name="$(var.AppDisplayName)" Description="!(loc.AppDescription)" Target="[INSTALLFOLDER]$(var.AppSingleExeName)" WorkingDirectory="INSTALLFOLDER" />
<RemoveFolder Id="RemoveApplicationProgramsFolder" Directory="ApplicationProgramsFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\$(var.AppFolderName)" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationShortcutDesktop" Guid="SOME-GUID-HERE">
<Shortcut Id="ApplicationDesktopShortcut" Name="$(var.AppDisplayName)" Description="!(loc.AppDescription)" Target="[INSTALLFOLDER]$(var.AppSingleExeName)" WorkingDirectory="INSTALLFOLDER" />
<RemoveFolder Id="RemoveDesktopFolder" Directory="DesktopFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\$(var.AppFolderName)" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
</Fragment>
</Wix>发布于 2020-01-23 12:32:45
我可能已经想出了办法来做这个。WIX有一个叫做Boostrapper项目的东西,它可以接收多个安装项目(msi或exe文件),并将它们全部安装在一个安装程序中。玩了一会儿之后,我注意到如果您部署了一个新版本的boostrapper安装程序,它有一些新版本的子安装程序和一些相同版本的子安装程序,那么只有新的版本才会被重新安装。
示例:
假设您有两个版本的引导程序安装程序,其中有以下的子安装程序版本:
Boostrapper安装程序1.0.0.0
1.0.0.0
Boostrapper安装1.0.1.0
1.0.1.0
如果您安装了引导程序安装程序1.0.0.0,那么引导程序安装程序1.0.1.0只会重新安装WPF应用程序,使数据库保持不变。
https://stackoverflow.com/questions/59872890
复制相似问题