Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在WIX主要升级中保留配置文件时卡住了!_Wix_Settings_Upgrade - Fatal编程技术网

在WIX主要升级中保留配置文件时卡住了!

在WIX主要升级中保留配置文件时卡住了!,wix,settings,upgrade,Wix,Settings,Upgrade,啊!Wix快把我逼疯了 所以,当然,我在stackoverflow和其他地方看到了很多关于WiX和主要升级的帖子。我使用WiX继承了这个软件项目,并发布了一个新版本。我需要这个新版本只保留一个配置文件(如果存在),并替换所有其他文件。这个安装程序可以正常工作,但不管我到目前为止做了什么,每次安装都会用新的XML文件替换旧的XML文件。甚至尝试使用NeverOverwrite=“yes”,甚至尝试使用OnlyDetect=“no”来回捣乱!我只是被卡住了,谦恭地请求一些指导。需要保留的文件名为SE

啊!Wix快把我逼疯了

所以,当然,我在stackoverflow和其他地方看到了很多关于WiX和主要升级的帖子。我使用WiX继承了这个软件项目,并发布了一个新版本。我需要这个新版本只保留一个配置文件(如果存在),并替换所有其他文件。这个安装程序可以正常工作,但不管我到目前为止做了什么,每次安装都会用新的XML文件替换旧的XML文件。甚至尝试使用NeverOverwrite=“yes”,甚至尝试使用OnlyDetect=“no”来回捣乱!我只是被卡住了,谦恭地请求一些指导。需要保留的文件名为SETTINGS.XML,位于All Users->ApplicationData目录中。这是(大部分)我的.wxs文件




已安装此程序的更高版本。

您可能需要做的第一件事是清除CommonAppDataPathwaysFolderComponent中的RemoveFolder。这将删除您的目录及其包含的所有内容(包括settings.xml)。添加neveroverwrite回写,看看会发生什么


您正在使用什么版本的wix?3对吗?

Windows installer仅在密钥路径不存在或指向较低版本的文件时安装组件。在单个文件组件的典型情况下,wix默认使用该文件作为密钥路径。在这种情况下,
CommonAppDataPathwaysFolderComponent
组件的键路径是注册表键;它已明确标记为
keypath=yes
属性

计划在安装新版本后卸载旧版本。因此,如果旧版本和新版本的该组件的键路径相同,那么事情应该按照您的意愿进行


它不起作用的事实意味着您已经更改了组件的键路径。显然,旧安装程序没有将“Software\TDR\paths,Installed=1”值写入注册表。新安装程序查找此注册表项,但未找到它,并决定安装
CommonAppDataPathwaysFolderComponent
——在过程中覆盖旧的SETTINGS.XML文件。

在测试中运行代码时,我收到此警告

警告LGHT1076:ICE57:组件 “CommonAppDataPathwaysFolderComponent” 具有pe r用户和每台机器 具有HKCU注册表键路径的数据

及 运行代码时日志文件中的错误如下

C:\Documents and Settings\All 用户\应用程序 Data\path\Settings.xml;覆盖;不会 补丁;现有文件未设置版本 和未修改的-哈希不匹配 源文件

这表示xml文件组件具有每台计算机的数据(xml文件),该数据具有每用户注册表项路径

将xml文件用作组件的密钥路径,如下所示:

<Component Id="CommonAppDataPathwaysFolderComponent" Guid="087C6F14-E87E-4B57-A7FA-C03FC8488E0D">
    <CreateFolder>
        <Permission User="Everyone" GenericAll="yes" />
    </CreateFolder>

    <RemoveFolder Id="CommonAppDataPathways" On="uninstall" />
    <File Id="settingsXml" KeyPath="yes" ShortName="SETTINGS.XML" Name="Settings.xml" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\Settings\settings.xml" Vital="yes" />
</Component>

这将使Windows Installer在决定是否替换此文件时使用未版本化的文件比较


您已在InstallFiles操作之后正确计划RemoveExistingProducts操作,以确保在删除旧版本之前安装新版本。

尝试此操作确实消除了light错误,但问题仍然存在,设置文件已被替换。另外,我需要替换的MDF和LDF文件仍然存在。我想知道这是否是因为旧安装的版本组件与新安装的版本组件不同,它具有不同的密钥路径,因此需要重新安装。如果是这样的话,那么除了将文件复制到临时位置,然后在安装完所有内容后返回的自定义操作之外,您没有什么可以做的了。请参阅我的帖子,作为这个问题的答案。快到了!将设置放在它自己的组件中有帮助,现在的问题是数据库也被保留了,需要替换!非常感谢。你把它分类了吗?您的组件不符合最佳实践。每个组件只能使用一个二进制文件。为了避免出现问题,我建议对于小型项目,每个文件使用一个组件。如果你知道你在做什么和/或你的设置是巨大的,只在一个组件中放几个文件。由于windows installer的性质,在更改组件创建之前,您将无法自动正确保留settings.xml文件。您需要编写一个自定义操作,以便在安装序列的早期备份设置文件,然后在安装后将其放回原位。
        <!-- program files directory -->
        <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLDIR" Name="Pathways"/>
        </Directory>

        <!-- application data directory -->
        <Directory Id="CommonAppDataFolder" Name="CommonAppData">
            <Directory Id="CommonAppDataPathways" Name="Pathways" />
        </Directory>

        <!-- start menu program directory -->
        <Directory Id="ProgramMenuFolder">
            <Directory Id="ProgramsMenuPathwaysFolder" Name="Pathways" />
        </Directory>

        <!-- desktop directory -->
        <Directory Id="DesktopFolder" />

    </Directory>

    <Icon Id="PathwaysIcon" SourceFile="\\Fileserver\Release\Pathways\Latest\Release\Pathways.exe" />

    <!-- components in the reference to the install directory -->
    <DirectoryRef Id="INSTALLDIR">
        <Component Id="Application" Guid="EEE4EB55-A515-4872-A4A5-06D6AB4A06A6">
            <File Id="pathwaysExe" Name="Pathways.exe" DiskId="1" Source="\\Fileserver\Release\Pathways\Latest\Release\Pathways.exe" Vital="yes" KeyPath="yes" Assembly=".net" AssemblyApplication="pathwaysExe" AssemblyManifest="pathwaysExe">
                <!--<netfx:NativeImage Id="ngen_Pathways.exe" Platform="32bit" Priority="2"/> -->
            </File>

            <File Id="pathwaysChm" Name="Pathways.chm" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\Pathways.chm" />

            <File Id="publicKeyXml" ShortName="RSAPUBLI.XML" Name="RSAPublicKey.xml" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\RSAPublicKey.xml" Vital="yes" />
            <File Id="staticListsXml" ShortName="STATICLI.XML" Name="StaticLists.xml" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\StaticLists.xml" Vital="yes" />

            <File Id="axInteropMapPointDll" ShortName="AXMPOINT.DLL" Name="AxInterop.MapPoint.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\AxInterop.MapPoint.dll" Vital="yes" />
            <File Id="interopMapPointDll" ShortName="INMPOINT.DLL" Name="Interop.MapPoint.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\Interop.MapPoint.dll" Vital="yes" />
            <File Id="mapPointDll" ShortName="MAPPOINT.DLL" Name="MapPoint.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\Interop.MapPoint.dll" Vital="yes" />

            <File Id="devExpressData63Dll" ShortName="DAAT63.DLL" Name="DevExpress.Data.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.Data.v6.3.dll" Vital="yes" />
            <File Id="devExpressUtils63Dll" ShortName="UTILS63.DLL" Name="DevExpress.Utils.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.Utils.v6.3.dll" Vital="yes" />
            <File Id="devExpressXtraBars63Dll" ShortName="BARS63.DLL" Name="DevExpress.XtraBars.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraBars.v6.3.dll" Vital="yes" />
            <File Id="devExpressXtraNavBar63Dll" ShortName="NAVBAR63.DLL" Name="DevExpress.XtraNavBar.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraNavBar.v6.3.dll" Vital="yes" />
            <File Id="devExpressXtraCharts63Dll" ShortName="CHARTS63.DLL" Name="DevExpress.XtraCharts.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraCharts.v6.3.dll" Vital="yes" />
            <File Id="devExpressXtraEditors63Dll" ShortName="EDITOR63.DLL" Name="DevExpress.XtraEditors.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraEditors.v6.3.dll" Vital="yes" />
            <File Id="devExpressXtraPrinting63Dll" ShortName="PRINT63.DLL" Name="DevExpress.XtraPrinting.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraPrinting.v6.3.dll" Vital="yes" />
            <File Id="devExpressXtraReports63Dll" ShortName="REPORT63.DLL" Name="DevExpress.XtraReports.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraReports.v6.3.dll" Vital="yes" />
            <File Id="devExpressXtraRichTextEdit63Dll" ShortName="RICHTE63.DLL" Name="DevExpress.XtraRichTextEdit.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraRichTextEdit.v6.3.dll" Vital="yes" />

            <RegistryValue Id="PathwaysInstallDir" Root="HKLM" Key="Software\Tribal Data Resources\Pathways" Name="InstallDir" Action="write" Type="string" Value="[INSTALLDIR]" />
        </Component>

    </DirectoryRef>

    <!-- application data components -->
    <DirectoryRef Id="CommonAppDataPathways">

        <Component Id="CommonAppDataPathwaysFolderComponent" Guid="087C6F14-E87E-4B57-A7FA-C03FC8488E0D">
            <CreateFolder>
                <Permission User="Everyone" GenericAll="yes" />
            </CreateFolder>

            <RemoveFolder Id="CommonAppDataPathways" On="uninstall" />
            <RegistryValue Root="HKCU" Key="Software\TDR\Pathways" Name="installed" Type="integer" Value="1" KeyPath="yes" />
            <File Id="settingsXml" ShortName="SETTINGS.XML" Name="Settings.xml" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\Settings\settings.xml" Vital="yes" />
        </Component>

        <Component Id="Database" Guid="1D8756EF-FD6C-49BC-8400-299492E8C65D">
            <File Id="pathwaysMdf" Name="Pathways.mdf" DiskId="1" Source="\\fileserver\Shared\Databases\Pathways\SystemDBs\Pathways.mdf" />
            <RemoveFile Id="pathwaysLdf" ShortName="Pathways.ldf" Name="Pathways_log.LDF" On="uninstall" />
        </Component>

    </DirectoryRef>

    <!-- shortcut components -->
    <DirectoryRef Id="DesktopFolder">
        <Component Id="DesktopShortcutComponent" Guid="1BF412BA-9C6B-460D-80ED-8388AC66703F">
            <Shortcut Id="DesktopShortcut"
                      Target="[INSTALLDIR]Pathways.exe"
                      Name="Pathways"
                      Description="Pathways Tribal Directory"
                      Icon="PathwaysIcon"
                      Show="normal"
                      WorkingDirectory="INSTALLDIR" />
            <RegistryValue Root="HKCU" Key="Software\TDR\Pathways" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
        </Component>
    </DirectoryRef>

    <DirectoryRef Id ="ProgramsMenuPathwaysFolder">
        <Component Id="ProgramsMenuShortcutComponent" Guid="83A18245-4C22-4CDC-94E0-B480F80A407D">
            <Shortcut Id="ProgramsMenuShortcut" Target="[INSTALLDIR]Pathways.exe" Name="Pathways" Icon="PathwaysIcon" Show="normal" WorkingDirectory="INSTALLDIR" />
            <RemoveFolder Id="ProgramsMenuPathwaysFolder" On="uninstall"/>
            <RegistryValue Root="HKCU" Key="Software\TDR\Pathways" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
        </Component>
    </DirectoryRef>


    <Feature Id="App" Title="Pathways Application" Level="1" Description="Pathways software" Display="expand" ConfigurableDirectory="INSTALLDIR" Absent="disallow" AllowAdvertise="no" InstallDefault="local">
        <ComponentRef Id="Application" />
        <ComponentRef Id="CommonAppDataPathwaysFolderComponent" />
        <ComponentRef Id="ProgramsMenuShortcutComponent" />
        <Feature Id="Shortcuts" Title="Desktop Shortcut" Level="1" Absent="allow" AllowAdvertise="no" InstallDefault="local">
            <ComponentRef Id="DesktopShortcutComponent" />
        </Feature>
    </Feature>


    <Feature Id="Data" Title="Database" Level="1" Absent="allow" AllowAdvertise="no" InstallDefault="local">
        <ComponentRef Id="Database" />
    </Feature>

    <!-- <UIRef Id="WixUI_Minimal" /> -->
    <UIRef Id ="WixUI_FeatureTree"/>
    <UIRef Id="WixUI_ErrorProgressText"/>

    <UI>
        <Error Id="2000">There is a later version of this program installed.</Error>
    </UI>

    <CustomAction Id="NewerVersionDetected" Error="2000" />

    <InstallExecuteSequence>
        <RemoveExistingProducts After="InstallFinalize"/>
    </InstallExecuteSequence>

</Product>
<Component Id="CommonAppDataPathwaysFolderComponent" Guid="087C6F14-E87E-4B57-A7FA-C03FC8488E0D">
    <CreateFolder>
        <Permission User="Everyone" GenericAll="yes" />
    </CreateFolder>

    <RemoveFolder Id="CommonAppDataPathways" On="uninstall" />
    <File Id="settingsXml" KeyPath="yes" ShortName="SETTINGS.XML" Name="Settings.xml" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\Settings\settings.xml" Vital="yes" />
</Component>