例如,我有一个开发web.config,我在我的localmachine上使用名为“localWeb.config”,然后我用于生产的名为“prodWeb.config”.我保留.config扩展名,因此没有人可以从Web服务器访问它们.
例如,localWeb.config将具有到开发数据库的连接字符串,而prodWeb.config有一个到生产数据库的连接字符串.
目前,我正在使用postbuild事件将localWeb.config或prodWeb.config的内容复制到web.config.这很好,但我想知道是否有人知道更好的方法.
查看 Web Deployment Tool:Here are just a few of the tasks that
be accomplished using the tool:
Create a package that contains content, configuration and SQL
databases for deployment or sharing
with others.Use the package as a way to version your application or create backups.
Add parameters to replace a connection string or other value in a
file during install of a package.Enable non-administrators to deploy packages and granularly control their
access.Synchronize or migrate both sites and servers running IIS 6.0 and IIS 7.0.