VS2005 Setup Project - How to prevent overwrite of file?

F

flutophilus

Hi,
I'm trying to create a VS2005 Setup Project. I have a config file
(MyApp.exe.config) that I need to deploy only the first time the app is
installed in a particular location. That is the file should not be
overwritten if a new version of the app is installed in the same location.
I know how to deploy the file but how do I prevent overwrite? Is it
something to do with the Condition property? I got completely lost in docs.
Any examples?

Thanks
 
S

Steven Cheng

Hi flutophilus,

As for the VS setup project overwriting old files(when install the same
program again on a box), it is actually not ovewritting, but remove and
install. VS setup program(or setup program created via installer sdk) will
always ensure one instance of the same program(via a uniqueID of the setup
program) on a machine. Thus, when you install the same program on a machine
that has already installed it, the process is as below:

** setup program first remove the original installed instance
** setup program install a new one

For your case here, I think the problem can be changed to "how to keep the
certain data file of a previous installed instance when installing the same
program again". I think you can consider the following means;

1. create a custom Action for your setup program to create the config file
for your application, also the creation code logic will check whether the
file is existing, if not, create it.

2. In the "uninstall" part of the custom action, do not remove the config
file

#Walkthrough: Redirecting an Application to Target a Different XML Web
Service at Installation
http://msdn2.microsoft.com/en-us/library/5k10s063(VS.80).aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.




--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top