none
Visual Studio Post build events RRS feed

  • Question

  • I want to maintain seperate config files for test and production like: web.config.Debug, web.config.Prod

    I do have the actual config file as web.config

    I am writing a post build event to copy the data from web.config.Debug to web.config when it is test or dev envirent (set in the Solution configuration drop down menu in the vs)

    and I am copying the data from web.config.Prod to web.config when it is prod envirent (set in the Solution configuration drop down menu in the vs)

    commandd used:

    xcopy "$(ProjectDir)web.config.$(ConfigurationName)" "$(ProjectDir)Web.config" /y

    I get error saying exited with code 4

    Friday, October 23, 2015 9:21 PM

Answers

  • Hi Aryaa,

    >>xcopy "$(ProjectDir)web.config.$(ConfigurationName)" "$(ProjectDir)Web.config" /y , I get error saying exited with code 4

    The command you are using looks correct, $(ProjectDir) contains "\" in its path.

    However I would recommend you test this code directly in the cmd.exe to see what is the return result, it should tell you more than MSBuild, not only exit with code 4.

    Also can you confirm that the ProjectDir is the correct folder?

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Aryaa Monday, June 4, 2018 8:24 PM
    Wednesday, November 4, 2015 1:16 PM
    Moderator

All replies

  • Hi Aryaa,

    This forum is discuss Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor.

    Since your problem is related to MSBuild, I will help you move this thread to MSBuild forum for a better help. It is appropriate and more experts will assist you.

    Best Regards,
    Weiwei

    Monday, October 26, 2015 2:34 AM
  • Hi,

    Thank you very much,.

    But could you also let me know where I should be looking up for my  thread after the move.

    Do you have any link to that..

    Thank you..

    Monday, October 26, 2015 2:44 PM
  • Hi Aryaa,

    >>xcopy "$(ProjectDir)web.config.$(ConfigurationName)" "$(ProjectDir)Web.config" /y , I get error saying exited with code 4

    The command you are using looks correct, $(ProjectDir) contains "\" in its path.

    However I would recommend you test this code directly in the cmd.exe to see what is the return result, it should tell you more than MSBuild, not only exit with code 4.

    Also can you confirm that the ProjectDir is the correct folder?

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Aryaa Monday, June 4, 2018 8:24 PM
    Wednesday, November 4, 2015 1:16 PM
    Moderator