Using different Web.config in development and production environment

前端 未结 10 2225
梦如初夏
梦如初夏 2020-11-22 12:50

I need to use different database connection string and SMTP server address in my ASP.NET application depending on it is run in development or production environment.

<
10条回答
  •  傲寒
    傲寒 (楼主)
    2020-11-22 13:14

    I use a NAnt Build Script to deploy to my different environments. I have it modify my config files via XPath depending on where they're being deployed to, and then it automagically puts them into that environment using Beyond Compare.

    Takes a minute or two to setup, but you only need to do it once. Then batch files take over while I go get another cup of coffee. :)

    Here's an article I found on it.

提交回复
热议问题