2010-05-19 122 views
4

編輯!WiX主要升級拒絕替換現有的文件!

這很簡單,這裏的問題似乎在首次發佈時看到,但當問到問題,然後回答時,對我來說似乎已經放棄了。我仍然有這個問題,不知道該怎麼做。

您好!我用WiX安裝程序繼承了這個項目,並且需要使此版本有效地升級上一個版本!我的問題是用新版本替換數據庫文件。不,問題不在於它們被鎖定,我可以手動更換它們,事實上現在其中一個被替換,而另一個不是。請告訴我我在這裏做錯了什麼。我已經嘗試了其他幾個解決方案(包括註冊表項作爲KeyPath而不是CompanionFile),但沒有任何工作。

這裏是(最)的.WXS文件的代碼:

<Product Id='$(var.ProductCode)' 
    UpgradeCode='$(var.UpgradeCode)' 
    Name="Pathways" 
    Version='$(var.ProductVersion)' 
    Manufacturer='$(var.Manufacturer)' 
    Language='1033'> 


    <Package Id="*" 
    Description="Pathways Directory Software" 
    InstallerVersion="301" 
    Compressed="yes" /> 

    <WixVariable Id="WixUILicenseRtf" Value="License.rtf" /> 
    <Media Id="1" Cabinet="Pathways.cab" EmbedCab="yes" /> 

    <Upgrade Id="$(var.UpgradeCode)"> 
     <UpgradeVersion 
    OnlyDetect="no" 
    Maximum="$(var.ProductVersion)" 
    IncludeMaximum="no" 
    Language="1033" 
    Property="OLDAPPFOUND" 
    /> 
     <UpgradeVersion 
    Minimum="$(var.ProductVersion)" 
    IncludeMinimum="yes" 
    OnlyDetect="no" 
    Language="1033" 
    Property="NEWAPPFOUND" 
    /> 
    </Upgrade> 

    <Property Id="ALLUSERS">2</Property> 

    <!-- directories --> 
    <Directory Id="TARGETDIR" Name="SourceDir"> 

     <!-- 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" />--> 

     </Component> 

     <Component Id="Settings" Guid="A3513208-4F12-4496-B609-197812B4A953" NeverOverwrite="yes"> 
      <File Id="settingsXml" KeyPath="yes" 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" > 
      <!-- <RegistryValue Root="HKLM" Key="Software\TDR\Pathways\Database" Name="installed" Type="integer" Value="1" KeyPath="yes" /> --> 
      <File Id="pathwaysMdf" Name="Pathways.mdf" DiskId="1" Source="\\fileserver\Shared\Databases\Pathways\SystemDBs\Pathways.mdf" CompanionFile="pathwaysExe" Vital="yes"/> 
      <File Id="pathwaysLdf" Name="Pathways_log.ldf" DiskId="1" Source="\\fileserver\Shared\Databases\Pathways\SystemDBs\Pathways.ldf" CompanionFile="pathwaysExe" Vital="yes"/> 

     </Component> 



     <!-- 
    <Component Id="MDF" Guid="FFB7CE02-B592-4c44-A315-99CF4828E3D9" > 
    <File Id="pathwaysMdf" KeyPath="yes" Name="Pathways.mdf" DiskId="1" Source="\\fileserver\Shared\Databases\Pathways\SystemDBs\Pathways.mdf" /> 
    </Component> 

    <Component Id="LDF" Guid="9E4E3DCA-A067-47f4-9905-4AD5C35A8025" > 
    <File Id="pathwaysLdf" KeyPath="yes" Name="Pathways_log.ldf" DiskId="1" Source="\\fileserver\Shared\Databases\Pathways\SystemDBs\Pathways.ldf" /> 
    </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="Settings"/> 
     <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_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> 

運行該安裝程序嘗試從以前的版本升級概工程。給我帶來麻煩的文件是名爲「PathwaysMdf」的文件。即使它的組件代碼與PathwaysLdf文件完全相同,該文件將被替換,而MDF不是。你可以看到,註釋掉了我嘗試過的其他一些東西,其中一些來自於stackoverflow的建議。

運行升級整個日誌文件位於: http://pastebin.com/ppjhq6Wi

THANK YOU! 約書亞

+0

剛提的是路徑:'\\文件服務器\發佈\途徑\依賴\'可以用定義的變量替換,以及... – Eli 2015-11-04 15:11:56

回答

1

你爲什麼要設置這些文件爲「pathwaysExe」的CompanionFile屬性?在此過程中,您要求Windows Installer根據是否更新這些文件來決定是否更新「pathwaysExe」。由於「pathwaysExe」版本沒有更改(因此Windows Installer不會更新它),因此其他文件同樣不會更新。

順便說一句,你說.ldf文件更新...你確定嗎?您發佈的日誌文件指示了其他情況。

+1

我設置CompanionFile因爲MDF和LDF文件是未版本化,並PathwaysExe的版本。 PathwaysExe正在更新,它是應用程序的主要可執行文件。 是的,我很肯定的是,LDF文件正在更新...我會重新檢查現在雖然。 – Joshua 2010-05-19 20:03:17

+0

是的,PathwaysExe和PathwaysLdf文件正在被更新,並且PathwaysMdf文件在升級後消失。 你可以看到爲什麼我很困惑。 ;) – Joshua 2010-05-19 20:18:02

2

您是否按照component rules

你爲什麼不使用每個組件一個文件?組件中的多個文件非常快速地變得非常難看。

(請注意,這是不是一個真正的WiX的問題,但更可能是一個Windows安裝程序的問題,由於違反規則的成分)

+0

我無法在這些組件規則中發現我應該爲每個組件創建一個文件。 LDF和MDF文件集合在一起,沒有彼此的用處,所以我認爲將它們作爲一個組件是有意義的。即使它們是一個組件,其中一個組件正確覆蓋,另一個不是。 閱讀這些規則並不能揭示我破壞它們的地方。 – Joshua 2010-05-20 19:14:38