Link to home
Start Free TrialLog in
Avatar of TheMoog
TheMoogFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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
Avatar of TheMoog
TheMoog
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Any takers to help me with the above question?  Thanks
Are  you deploying these as "ClickOnce" applications?
Avatar of TheMoog

ASKER

no its a setup and deployment method
Avatar of TheMoog

ASKER

is there anyone in the community who can help me with this deployment question?
SOLUTION
Avatar of Stacy Spear
Stacy Spear
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Vadim Rapp
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.
Avatar of TheMoog

ASKER

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
Your deployment solution, files folder properties.
Avatar of TheMoog

ASKER

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.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of TheMoog

ASKER

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

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 .
Avatar of TheMoog

ASKER

Thanks Im taking careful note of that.  Thank you for all the help.
Avatar of TheMoog

ASKER

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.