Include referenced exe.config in ClickOnce release

Discussion Include referenced exe.config in ClickOnce release

  • Monday, August 06, 2012 4:47 PM
     
     

    Hi,

    I have a solution with a main project and a standalone executable project (.exe), and the main project references the standalone project.  When I build the solution and publish the main project, the standalone.exe successfully gets included in the mainproject bin folder, but I am not getting the standalone.exe.config (which is converted from app.config).  I added an AfterBuild event in the csproj file to copy the standalone.exe.config into the main bin folder, but it still is not publishing into the ClickOnce release.  What do I need to do to get my standalone.exe.config into the ClickOnce release?

    Thanks in advance for your answers!

    Will

All Replies

  • Thursday, August 09, 2012 2:33 AM
    Moderator
     
     

    Hi Will,

    According to my understanding, if you references other project in your main project and publish, you may get an InvalidDeploymentException at installation. If you just want to include the files, I think you may try to add the existing items to your main project, and change the Copy to Output Directory property to Copy Always.

    Best regards,


    Chester Hong
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Friday, August 10, 2012 7:08 AM
    Moderator
     
     

    ClickOnce only publishes files it knows about. Just putting them in the directory won't help you.

    Add the file to the project and set the build action to "content" and set "copy to output directory" to "copy always". Now the file will be included every time you build or deploy it.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev

  • Wednesday, August 15, 2012 12:44 AM
     
     

    Hi Robin,

    This is basically what I did, but I had to put a dummy copy of the file in the main directory so I could set it to "Content" type.  Then I had the Builder overwrite that file after build (copy from App.config in the referenced app to Standalone.exe.config in the main app).  ClickOnce was able to pick up the config file after that.  I'm not sure if that's the most kosher way to do it but it works.  Thanks for your answer!

    Will