简体   繁体   English

Visual Studio安装项目中的自定义web.config

[英]Custom web.config in Visual Studio Setup Project

In the Setup Project I have 2 web.config files: web.config - used during the development and web_dist.config - the one that should be included into Setup Project. 在安装项目中,我有2个web.config文件: web.config在开发过程中使用的文件和web_dist.config应该包含在安装项目中的文件。

I must be sure the the Setup project will NOT include the web.config and will always include web_dist.config . 我必须确保安装项目不会包含web.config并且始终会包含web_dist.config

In the File System -> Web Application Folder I have added the Content Files from the project. 在文件系统-> Web应用程序文件夹中,我从项目中添加了内容文件。
Also included the web_dist.config and mapped it to the web.config. 还包括了web_dist.config并将其映射到web.config。

But this gives the warning: 但这给出了警告:

WARNING: Two or more objects have the same target location ('[targetdir]\web.config')

And the actual config file included is web.config and not web_dist.config . 并且实际包含的配置文件是web.config而不是web_dist.config

What would be the best option to include the web_dist.config (and named as web.config in the setup)? 包含web_dist.config (在安装程序中名为web.config)的最佳选择是什么?

Thanks, 谢谢,
Dmitriy. 德米特里。

I was able workaround this by setting " Build Action " for the web.config to " None ". 我可以通过将web.config的“ Build Action ”设置为“ None ”来解决此问题。
This way it doesn't get included into the setup package. 这样,它就不会包含在安装程序包中。

Then I just added another config file manually. 然后,我只是手动添加了另一个配置文件。

Works like a charm for this particular situation. 在这种特定情况下,它就像是一种魅力。

http://msdn.microsoft.com/en-us/library/zhx4ah11(VS.80).aspx http://msdn.microsoft.com/en-us/library/zhx4ah11(VS.80).aspx

Does following trick work in your case? 请问以下技巧对您有用吗?

You can correct this by adding a Custom folder and setting its DefaultLocation property to the same value as the first folder, then moving the second copy of the file to the new folder. 您可以通过添加“自定义”文件夹并将其DefaultLocation属性设置为与第一个文件夹相同的值,然后将文件的第二个副本移动到新文件夹来更正此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是什么导致Visual Studio使用旧的web.config? - What would cause Visual Studio to use an old web.config? Visual Studio发布选择错误的web.config转换 - visual studio publish choosing wrong web.config transform 尝试加载自定义配置时,Visual Studio安装和部署项目中的FileNotFoundException - FileNotFoundException in Visual Studio Setup and Deployment Project when trying to load custom config Visual Studio安装项目自定义对话框 - Visual Studio Setup Project Custom Dialog Visual Studio设置项目的自定义先决条件 - Custom prerequsites to visual studio setup project 如何在 Visual Studio Web 2013 中添加 app.config 或 web.config 文件? - How can I add an app.config or web.config file in Visual Studio Web 2013? 如何设置web.config以查看ASP.NET MVC3项目的完整错误消息 - How to setup web.config to see the complete error message for ASP.NET MVC3 project 编译时,Visual Studio从Web.config使用什么设置? - What settings does Visual Studio use from the Web.config at compile time? 在AngularJS项目中访问.net Web.Config - Accessing .net Web.Config in AngularJS project Visual Studio 2013 Web.Config 转换 - 如何禁用自动格式化/换行符? - Visual Studio 2013 Web.Config transformation - How to disable automatic formatting/line breaks?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM