Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Excel 2003 VSTO setup project not replacing workbook on upgrade install
 

Excel 2003 VSTO setup project not replacing workbook on upgrade install

Hi, I have an Excel 2003 document level customization built in VS2008. I've followed the deployment guides on creating a setup project for VSTO and it's working as expected when I do a fresh install.

The problem I have now is if I have an old version (1.0) of the application already installed, and want to do an upgrade install to a new version (2.0) using the Setup project's msi installer. I noticed when I try this that the application's 2.0 .xls workbook is not being installed correctly; instead it leaves the 1.0 workbook. The 1.0 workbook even has its timestamp updated to the new install time. All the other assemblies have correctly been updated to 2.0 but the workbook still being 1.0 causes problems when it cannot load any assemblies.

To replicate I used the project file for Excel 2003 Workbook Setup in the deployment sticky and performed the following steps.
http://code.msdn.microsoft.com/VSTO2005SEMSI/Release/ProjectReleases.aspx?ReleaseId=1932

1. Change Setup project's RemovePreviousVersion property to True.
2. Build the setup project and install the output msi (1.0).
3. Make a modification to the project workbook, ie. type "test" in A1 of Sheet1.
4. Update version number of all projects to 2.0.
5. Update version number of Setup project to 2.0 and build.
6. After installing 2.0, all assemblies have been updated but the .xls is still from the 1.0 install though the timestamp of the .xls was updated to the new installation time (2.0). Trying to open the workbook fails at this point since it is still looking for 1.0 assemblies. As a sanity check, the modification we made "test" for the 2.0 workbook is also not present.

Is this expected of the Setup project? I noticed that other misc files that I include to for copying do get overwritten. Only the workbook is left unchanged (besides its timestamp). As another sanity check, any modifications to the installed 1.0 workbook are also still present after the 2.0 install.

I would like the previous workbook to get overwritten by the newest version when running an upgrade msi installer that removes previous versions. Is there an option I should set? Do I need to create a custom action?

I don't recall this happening when my setup project for VSTO was built in VS2005.

Thanks!
sleepp  Thursday, February 05, 2009 7:12 PM
Update methodology changed in VS 2008 to update files using versioning rules rather than the previous method of uninstall everything then install all the new stuff that was used in VS 2005.
Versioning rules include "don't replace a file that has been updated by the user", so I assume that the workbookl has been altered in some way. If you installed a product with a Word doc, you updated the Word doc, and then applied a patch that replaced the doc file you'd be upset - that's what this is trying to prevent. The same is true of databases that have been installed and updated. I'd expect the 1.0 workbook to have different create and modify dates, that's the "been updated since install" marker.


Phil Wilson
PhilWilson  Thursday, February 05, 2009 8:33 PM
That would work. Assuming you're doing this update immediately after the install you would do those updates and then set the file timestamps so that the modify date is the same as the creation date, then it is unaltered. If a user goes in there later though you the dates would obviously change again and prevent replacement.
Phil Wilson
PhilWilson  Friday, February 06, 2009 9:29 PM
Update methodology changed in VS 2008 to update files using versioning rules rather than the previous method of uninstall everything then install all the new stuff that was used in VS 2005.
Versioning rules include "don't replace a file that has been updated by the user", so I assume that the workbookl has been altered in some way. If you installed a product with a Word doc, you updated the Word doc, and then applied a patch that replaced the doc file you'd be upset - that's what this is trying to prevent. The same is true of databases that have been installed and updated. I'd expect the 1.0 workbook to have different create and modify dates, that's the "been updated since install" marker.


Phil Wilson
PhilWilson  Thursday, February 05, 2009 8:33 PM
Thanks so much for the explanation!

Unfortunately for the VSTO setup examples, the workbook is always modified after installation since it updates the manifest to point to assemblies in the installed directory. Assuming we update the manifest, the end result is a setup program that never works for upgrade installation. In our specific situation, we don't expect users to save the workbook, and if they do, we tell them to back it up before upgrading; so deleting the file would be preferable. But I can understand how either case would have undesirable effects.

So what would be the best way to work around this behavior change? Should I attempt to modify the timestamp after updating the manifest in hopes that only user performed modifications would cause the versioning rules to activate? Thanks!
sleepp  Friday, February 06, 2009 2:10 PM
That would work. Assuming you're doing this update immediately after the install you would do those updates and then set the file timestamps so that the modify date is the same as the creation date, then it is unaltered. If a user goes in there later though you the dates would obviously change again and prevent replacement.
Phil Wilson
PhilWilson  Friday, February 06, 2009 9:29 PM

You can use google to search for other answers

Custom Search

More Threads

• Pre-Install process for deployment
• About Custom Actions
• Desktop Shortcut
• Clicking on a desktop shortcut causes the installer to try to reinstall the program
• Uninstall: How to hide the DOS command window?
• Attaching an Icon to an application
• ClickZero?
• Smart Client Install/Uninstall broken
• Still waiting on GenerateBootstrapper
• Custom Permissions for ClickOnce Application