locked
How to upload/generate my own web.config file? RRS feed

  • Question

  • User1302062155 posted

    Hello,

    I've been given a project written with .NET Framework 4.5.2 and <g class="gr_ gr_12 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" id="12" data-gr-id="12">i</g> have a problem to fix: whenever I publish an asp.net MVC project using the web publish utility in VSCode Visual Studio 2017 I automatically generate a web.config file along with the built project.

    In this case, the web.config file is not correct: in this specific case the web.config file isn't handling the automatic HTTP to HTTPS redirect so I always have to manually edit a web.config file every time (or worse, I always have to overwrite the automatically generate web.config file with my custom one every time I publish).

    What's the best way to handle web.config files? How can I upload my custom one, or better, how can I generate a correct one?!

    Thanks in advance :)

    Monday, April 1, 2019 2:20 PM

Answers

  • User1520731567 posted

    Hi Fieel,

    What is your file Properties of your web.config.

    You could pay attention to the Build Action,it represents how the file relates to the build and deployment processes.

    "Content" is the default value.

    You could refer to this link:

    https://stackoverflow.com/a/145769

    Or 

    Do you mean you want to synchronize web.config for formal and development environments?

    If so,you can only copy files manually.

    Best Regards.

    Yuki Tao

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 2, 2019 10:12 AM

All replies

  • User1520731567 posted

    Hi Fieel,

    Visual Studio Code does not have an integrated build system (Web Publish) like Visual Studio does.

    How do you publish your project?

    Comment Line or Extensions?

    Best Regards.

    Yuki Tao

    Tuesday, April 2, 2019 6:53 AM
  • User1302062155 posted

    Hey Yuki,

    my bad, <g class="gr_ gr_3 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" id="3" data-gr-id="3">i'm</g> using Visual Studio 2017 Enterprise, it was a typo!

    Tuesday, April 2, 2019 7:19 AM
  • User1520731567 posted

    Hi Fieel,

    What is your file Properties of your web.config.

    You could pay attention to the Build Action,it represents how the file relates to the build and deployment processes.

    "Content" is the default value.

    You could refer to this link:

    https://stackoverflow.com/a/145769

    Or 

    Do you mean you want to synchronize web.config for formal and development environments?

    If so,you can only copy files manually.

    Best Regards.

    Yuki Tao

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 2, 2019 10:12 AM
  • User1302062155 posted

    <g class="gr_ gr_30 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-ins replaceWithoutSep" id="30" data-gr-id="30">Thanks</g> Yuki, the web.config properly "Build Action" wasn't properly <g class="gr_ gr_119 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del" id="119" data-gr-id="119">setup</g> as expected!

    Now my custom web.config gets published along with the rest of the project. :)

    Monday, April 15, 2019 9:25 AM