locked
App.config for release and another for debug RRS feed

  • Question

  • Hi All,

    I would like to create a app config for debug and release. I want my installation program to replace settings for release mode builds, so I would like to setup two app configurations. In other words my app.config for debug would contain something lilke...

    <appSettings>
    <add key="ServiceUri" value="http://localhost:14314" />
    </appSettings>

    and then for release mode I have a variable that would be replace by the installation and would look something like this...

    <appSettings>
    <add key="ServiceUri" value="&lt;ServiceUri&gt;" />
    </appSettings>

    So I want to have an easy way to specify two different configurations. I am using Visual Studio 2015, but would definitely want something that will be compatible with 2017.

    Does anybody have any suggestions?

    Thanks,

    Tom


    • Edited by Thomas Lee3 Tuesday, February 13, 2018 9:57 PM
    Tuesday, February 13, 2018 9:56 PM

Answers

All replies

  • So I want to have an easy way to specify two different configurations. I am using Visual Studio 2015, but would definitely want something that will be compatible with 2017.

    Does anybody have any suggestions?

    https://sunauskas.com/blog/edit-config-file-with-powershell/

    Tuesday, February 13, 2018 10:19 PM
  • Hi Tom,

    The following documents would be helpful:

    Different application settings depending on configuration mode

    Visual Studio: differentiate app.config for debug and release mode

    Enable app.debug.config app.release.config

    HowTo: Generate different app.config for debug or release in non-web projects

    Regards,

    Frankie

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, February 14, 2018 6:09 AM
  • See the following Visual Studio extension

    https://marketplace.visualstudio.com/items?itemName=GolanAvraham.ConfigurationTransform


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Marked as answer by Thomas Lee3 Wednesday, February 14, 2018 3:49 PM
    Wednesday, February 14, 2018 12:08 PM
  • Awesome! Thanks Karen, that is exactly what I was looking for.
    Wednesday, February 14, 2018 3:50 PM