deploy website with production configuration automatically in Visual Studio 2010

荒凉一梦 提交于 2019-12-25 05:15:46

问题


I have a question regarding Visual Studio 2010 publish feature which is used after you create a website (MVC framework) to push your dev changes to the live site.

I've never worked with MVC until a few weeks ago and I've noticed that before pushing the website code I have to change everywhere where I have localhost in the code and replace it with the domain name I'm pushing to. Then if I want to debug anything on my local machine I have to revert everything back to localhost from domain name.

Q: Is there a way to not do this back and front url changing?

Basically I think it boils down to needing a software package or sth that knows to deploy the website with production configuration.

Maybe have a local branch and a live branch? This involves merging files all the time.

Thanks :)


回答1:


I am not sure it works with MVC, but one approach we use for web services development is to use the web.config transformations.

This means that the normal development stuff is in Web.config and we have separate configurations depending on the deployment environment Web.staging.config and Web.production.config.



来源:https://stackoverflow.com/questions/10915325/deploy-website-with-production-configuration-automatically-in-visual-studio-2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!