开发者

How to have PathwaysMDF and LDF overwrite old copies on a major upgrade of Wix?

I need both these files, PathwaysMDF and PathwaysLDF to replace (overwrite) the old copies on a major upgrade.

Okay, this WiX is driving me crazy. The settings file works perfectly, however the database files are still not working! I have tried several approaches...

Here is the code attempting this with the registry key:

<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" />
<File Id="pathwaysLdf" Name="Pathways_log.ldf" DiskId="1" Source="\\fileserver\Shared\Databases\Pathways\SystemDBs\Pathways.ldf"/>
</Component>

This results in the old LDF file remaining, and no MDF file there at all, when completed, not the old one, nor the new one.

Here is what the log says about that attempt: (complete log at http://pastebin.com/a8a7uKfL)

MSI (s) (C8:80) [09:01:51:845]: Executing op: SetTargetFolder(Folder=C:\Documents and Settings\All Users\Application Data\Pathways) MSI (s) (C8:80) [09:01:51:845]: Executing op: SetSourceFolder(Folder=1\ykpqggg9\Pathways\|CommonAppData\Pathways) MSI (s) (C8:80) [09:01:51:845]: Executing op: FileCopy(SourceName=x_gekdq7.ldf|Pathways_log.ldf,SourceCabKey=pathwaysLdf,DestName=Pathways_log.ldf,Attributes=512,FileSize=40239104,PerTick=32768,,VerifyMedia=1,,,,,CheckCRC=0,,,InstallMode=58982400,HashOptions=0,HashPart1=-403787921,HashPart2=771061375,HashPart3=-1732951415,HashPart4=-1390528611,,) MSI (s) (C8:80) [09:01:51:845]: File: C:\Documents and Settings\All Users\Application Data\Pathways\Pathways_log.ldf; Won't Overwrite; Won't patch; Existing file is unversioned but modified MSI (s) (C8:80) [09:01:51:845]: Executing op: FileCopy(SourceName=Pathways.mdf,SourceCabKey=pathwaysMdf,DestName=Pathways.mdf,Attributes=512,FileSize=156368896,PerTick=32768,,VerifyMedia=1,,,,,CheckCRC=0,,,InstallMode=58982400,HashOptions=0,HashPart1=570808063,HashPart2=-1571218748,HashPart3=-867678845,HashPart4=601212343,,) MSI (s) (C8:80) [09:01:51:845]: File: C:\Documents and Settings\All Users\Application Data\Pathways\Pathways.mdf; Won't Overwrite; Won't patch; Existing file is unversioned but modified

Here is the code attempting this using a companion file (the main program executable, which is versioned):

<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" CompanionFile="pathwaysExe" />
<File Id="pathwaysLdf" Name="Pathways_log.ldf" DiskId="1" Source="\\fileserver\Shared\Databases\Pathways\SystemDBs\开发者_C百科Pathways.ldf" CompanionFile="pathwaysExe" />
</Component>

The result of this is that the LDF file behaves perfectly, replacing the old with the new, however, the MDF file is GONE. Old one and new one alike, missing.

Here is what the log says about that attempt: (complete log at http://pastebin.com/gijLN5QY):

MSI (s) (C8:F8) [09:21:55:206]: Executing op: SetCompanionParent(ParentPath=C:\Program Files\Pathways\,ParentName=Pathways.exe,ParentVersion=1.1.5.0,ParentLanguage=0) MSI (s) (C8:F8) [09:21:55:206]: Executing op: FileCopy(SourceName=Pathways.mdf,SourceCabKey=pathwaysMdf,DestName=Pathways.mdf,Attributes=512,FileSize=156368896,PerTick=32768,,VerifyMedia=1,,,,,CheckCRC=0,Version=pathwaysExe,,InstallMode=58982400,,,,,,,) MSI (s) (C8:F8) [09:21:55:236]: File: C:\Documents and Settings\All Users\Application Data\Pathways\Pathways.mdf; Overwrite; Won't patch; Existing file is of an equal version (Checked using version of companion: C:\Program Files\Pathways\Pathways.exe) MSI (s) (C8:F8) [09:21:55:236]: Source for file 'pathwaysMdf' is compressed InstallFiles: File: Pathways.mdf, Directory: C:\Documents and Settings\All Users\Application Data\Pathways\, Size: 156368896 MSI (s) (C8:F8) [09:21:55:246]: Re-applying security from existing file. MSI (s) (C8:F8) [09:21:55:246]: Verifying accessibility of file: Pathways.mdf MSI (s) (C8:F8) [09:21:55:266]: Note: 1: 2318 2: C:\Documents and Settings\All Users\Application Data\Pathways\Pathways.mdf MSI (s) (C8:F8) [09:21:55:266]: Note: 1: 2360 MSI (s) (C8:F8) [09:21:55:266]: Note: 1: 2360

I have also tried setting just the MDF file to KeyPath="yes" without the CompanionFile tag. This also isn't working.


It sure seems to me that the upgrade design is highly flawed with WiX. What should be happening, is that each File should, by default "always replace" anything. Only files marked with an appropriate attribute should be considered for versioning and other considerations.

WiX seems to be designed for only installing .exe and .dll or other explicitly known to have a version files. That's unfortunate, because it could much more effective and stop so many people wasting their time, if it was actually designed to be a general purpose install mechanism.


Try deleting the RemoveFile entries in the Database component. They are telling the installer to only remove on uninstall, when upgrading, the process is UPGRADINGPRODUCTCODE not UNINSTALL. Besides you only need the removefile entry if you want to remove a file that wasnt created by your installer, (or if you want to control what happens like only remove on upgrade etc)

anyhow try this

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

EDIT 1

If you get these problems its always useful to look at the log, to generate a log run the following command

msiexec /i "\PATHTOSETUP\setup.msi" /l*xv

x is for extra debugging which might produce too much noise so you might exclude that switch however the v for verbose is normally quite useful.

If the above suggestion doesnt fix it can you paste your log somewhere like http://pastebin.com/

EDIT 2

Ok. The pathwaysmdf file is unversioned. When it comes to upgrade time Windows Installer compares the current and new file if they are both unversioned and the file has changed it assumes that the user has altered it and thus it leaves it. This comparison is done on the keypath, which in your case is the pathwaysmdf file. To fix this either create a dummy file or registry key as the components keypath. I would suggest something like a registry key

HKLM\Software\YOURCOMPANY\YOURPRODUCT\Database\Isinstalled = 1
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜