none
HOWTO Make VS2010 I installation project not overwrite files.

    Question

  • HOWTO Make VS2010 I installation project not overwrite files.

    Please help,

    I have a VS2010 Installation program which uses the "Primary Output" feature to install a windows app. The app is called "MyApp" and has a app.config called MyApp.exe.config, which I do not want overwritten when the installer runs. How can I make the installer NOT overwrite the file.

    I am aware of setting the "Permenent" to true for individual files, but as this comes from "Primary Output", and the config file is not made until the MyApp is built, I can not just include "MyApp.exe.config" to the installation app and then set "Permenent = true". At least not to my knowledge.

    How can I ensure MyApp.exe.config is not overwritten?

    Is there a way one could edit MyApp's ProjectInstaller.cs and modify it to capture every file the installer was about to do anything with, and then be able to programmatically change the outcome. But there appears to be no means to do that.

     

    • Moved by Alexander Sun Wednesday, October 05, 2011 6:06 AM ClickOnce issue (From:.NET Framework Setup)
    Thursday, September 29, 2011 2:54 PM

Answers

All replies

  • I have found  "A" solution for at least app.config. It is not exactly what I would like, but it seems to work consistantly.

    In the installer project, add the MyApp.exe.config file as a separate file, and set its "Permanent" to true. Do this, even though the app.config ==> MyApp.exe.config is part of the "Primary Output" of MyApp. This so far, does nto erase the MyApp.exe.Config when the unistall is done, and does not overwrite it when installing.

    A better way would be if VS2010 would let one open the "Primary Output" and set "Permanent = true" on the individual files.

     

    • Proposed as answer by Alexander Sun Wednesday, October 05, 2011 6:03 AM
    Thursday, September 29, 2011 7:46 PM
  • Hi J-S-B,

     

    Welcome to the MSDN forum.

     

    I am sorry that this queue is about .NET Framework Setup. In my opinion, your problem is project setup and deployment, so for better support, I will move your thread to ClickOnce forum.

     

    Sorry for any inconvenience.

     

    Best Regards,


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, October 05, 2011 6:05 AM
  • If you want operate the file separately, then it would be a good choice to add the project output files as File, instead of use the add primary output option to add those files, then you will have the choice to set the property for each file.
    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, October 05, 2011 6:06 AM
  • What is the problem you're worried about? The file overwrite rules are that a data file won't be replaced unless it has been changed since install time. That means that if it does get replaced then it was never updated anyway.  Nobody wants an upgrade to completely replace a database full of updated info - your config file is the same.

    http://msdn.microsoft.com/en-us/library/aa370531(VS.85).aspx 


    Phil Wilson
    Wednesday, October 05, 2011 7:59 PM
  • What is the link to the ClickOnce forum?

     

    Thursday, October 06, 2011 5:02 PM
  • You're in the ClickOnce forum now.
    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, October 07, 2011 1:26 AM
  • Note that Permanent really really means permanent. It's a terrible idea. It marks that file as never to be uninstalled from the system. You can't turn if off later. 

    In the absence of a response to my question about what problem you're trying to solve (because I don't think there is one) I can't add anything. An upgrade will not replace data files that have been changed, so there is no need to worry about "overwriting" a config file that was updated after it was installed.


    Phil Wilson
    Friday, October 07, 2011 11:22 PM