简体   繁体   中英

Publishing using different Web.config

I have a Visual Studio 2010 web-application solution I have created. In this solution I have created a new mode in the configuration manager called "MyProjectName". I have created an additional transform (I think you call it). ie Web.MyProjectName.config.

When I choose the publish option on the project, I have the "MyProjectName" option selected from the build mode.

However, the Web.MyProjectName.config is not copied to the published folder.

How do I get different Web.config's published depending on what configuration mode I have selected?

Thanks in advance.

You will need to copy your new config file using either of the two options:

  • modify your project file to add a Target Named "BeforeBuild" (or modify if it exists)
  • add a "Pre Build" event

(I prefer the first one)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM