c# copy to output directory depending on first install or an update install

Guys,

Im having trouble getting my head around how to do the following:

I have perhaps 12 text files that get copied to the output directory on deployment.  These files contain the users settings for GUI etc.  On the first ever install theres no issue.

When I send an update via msi file at a later point I do NOT want to copy the files over the current users files as that will not be good.  I would like to do it by giving the user a choice in the installer and I have setup a user interface dialog with two radio buttons saying

"Do you wish to keep your current settings?"

Problem is I don't know what to do from here, how do I link that in to prevent say 8 out of the 12 files from copying on the update?

Thanks guys
TheMoogAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TheMoogAuthor Commented:
Any takers to help me with the above question?  Thanks
0
Death259Commented:
Are  you deploying these as "ClickOnce" applications?
0
TheMoogAuthor Commented:
no its a setup and deployment method
0
The Five Tenets of the Most Secure Backup

Data loss can hit a business in any number of ways. In reality, companies should expect to lose data at some point. The challenge is having a plan to recover from such an event.

TheMoogAuthor Commented:
is there anyone in the community who can help me with this deployment question?
0
Stacy SpearPresident/Principal ConsultantCommented:
Did you solve this? If not, you need to set a condition property as so http://msdn.microsoft.com/en-us/library/025bcetc(VS.90).aspx AND you need to set the transitive property to true as well. http://msdn.microsoft.com/en-us/library/928tb19t(VS.90).aspx

0
Vadim RappCommented:
1. specify property REINSTALLMODE=amus . You can set this property depending on user's input in the dialog, however, it will work for all files in the package.

or

2. Forcefully delete old files by custom action or by populating the table RemoveFile and specifying condition for the action RemoveFiles - the condition based on the property bound to user's input.
0
TheMoogAuthor Commented:
I did not know where to set REINSTALLMODE the only google references I could find involved something to do with ORCA.  So I gave up hope there. and I couldnt find the table removefile. but I understood your logic of what you are saying.

The posts for microsoft were fairly general as ive looked at that but they did help.  What I have sort of done and please let me know if there's an easier way as it took some thinking etc..

I made two versions of the content files output using the condition logic ie BUTTON2 = 1 and BUTTON2 = 2 etc and in both I made them permanent so they do not delete and transitive.  then I used an exclude filter on one of the versions of the content files output and put the static filenames in there.  It seems a bit static to do that, there was no folder setting which became obvious why a bit later.  

I think I have it operating but can you let me know if there's an easier or superior way of doing this as it seems quite an irksome process to do especially the manual filter?  Why don't they just list all the content files in a visual list and have a check-box of the ones you want to filter out?  Seems a bit mad, but hey I'm the one on the learning curve...  Would appreciate some positive feedback, thank you gentlemen
0
Stacy SpearPresident/Principal ConsultantCommented:
Your deployment solution, files folder properties.
0
TheMoogAuthor Commented:
darkstar I don't understand what you are referencing in the post above? it is a bit vague?, I believe I have solved it with help from you both but if there's an easier way please explain? I don't know whether you are saying I'm correct or I'm incorrect on the solution I have outlined? Cheers.
0
Vadim RappCommented:
> The posts for microsoft were fairly general as ive looked at that but they did help.  

Here's the deal. Setup and Deployment Project (SDP) in Visual Studio is supposed to give you interface for the most basic things with the installation. Your problem is outside of that basic area. But Installer is capable of much more, and the solutions I mentioned are in that "much more".

Those advanced features are possible by two ways.

1. getting more advanced installation authoring tool, like Installshield or Wise. They are quite expensive, but you can try them out for free, maybe even just to see how much is hidden "under the hood" of the installation.

2. writing custom actions in your Setup and deployment project. This is "standard" way to accomplish things in SDP. You'll have to learn object model of Installer and data model of the installation database, pretty much the same way as you have learned your main programming language and object model of the objects you used in your application. The reference is in VS Help and on Microsoft website.

The method you came up with, with BUTTON=1 and =2, is practically guaranteed to give you trouble.


> made them permanent so they do not delete and transitive

Permanent component means that it won't be removed during un-installation. Transitive means that the condition will be re-evaluated during re-installation, rather then remembered from the initial installation. For example, if file X is installed only if the system is Windows 95, and the user later upgrades to XP, and then performs a repair of the product, then transitive component will be removed, but non-transitive will stay. I don't think any of these two features are related to what you are trying to accomplish.

There's however yet another way to resolve your problem, and I think it's optimal: do that in the application. Your installation can create a registry key that will tell the application that it's first launch after the upgrade; once the application has detected that, it would ask if the user prefers to keep old data files, or reset them.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Stacy SpearPresident/Principal ConsultantCommented:
You have a Setup project as part of your solution correct? In that deployment solution, you have a File System on Target machine which has an Application Folder underneath. The properties of that has the AlwaysCreate and Transitive properties. You need to set a Condition statement that looks at the variable set by the radio buttons you setup that determine whether or not to overwrite the current files.
0
TheMoogAuthor Commented:
Thank you for the posts these are very helpful.  Darkstar, yes now I understand.  I do think what you have outlined and with your help I have managed to achieve just that, and it seems to be  working but I can see future snags, forgetting to place files in the filter... not removing them if I change paradigm etc, its like having two variables doing the same thing thats what made me balk once I understood the process.

vadimrapp1 >> The method you came up with, with BUTTON=1 and =2, is practically guaranteed to give you trouble.  << this is what Ive done trying to figure out everybody's input from yesterday.  

I understand what you are saying over the registry.  I seem to have been misguided by what can be achieved in the installer thus then without thinking of the alternatives.  The registry would be more flexible down the track I suppose as I can just base flexible code on that.  Hmmm...

OK any other input before I award some points?  If I dont hear back ill just split 50/50 if thats OK with you chaps

0
Vadim RappCommented:
I suggest that you _very_ carefully very that it indeed works as you want. The reason I'm saying this is because Transitive attribute seems irrelevant for your purpose; AlwaysCreate is applicable to the folder, and is an instruction to create the folder even when it's empty; Condition tells when to install and when not to, but it has nothing to do with overwriting old files - details of how Installer handles this can be read in the article "How Windows Installer handles file replacement logic for versioned and unversioned files" at http://blogs.msdn.com/astebner/archive/2005/08/30/458295.aspx .
0
TheMoogAuthor Commented:
Thanks Im taking careful note of that.  Thank you for all the help.
0
TheMoogAuthor Commented:
Got there in the end, this is a case where the asker ie me couldn't scope what my issue was properly until being enlightened and guided by learned persons, once the light came on things became a lot easier.  Thank You.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Software

From novice to tech pro — start learning today.