简体   繁体   English

在Visual Studio中将控制台应用程序从4.5.1转换为3.5会导致不再拾取控制台App.config

[英]Converting console application from 4.5.1 to 3.5 in visual studio causes the console App.config to no longer be picked up

I have a Console project that was created targeting .Net 4.5.1 that needs to be re-targeted to .Net 3.5. 我有一个针对.Net 4.5.1创建的控制台项目,该项目需要重新定位至.Net 3.5。

When I re-target in Visual Studio 2013, the original config file is no longer picked up. 当我在Visual Studio 2013中重新定位时,不再获取原始配置文件。

The old App.config also start throwing random warnings about seemingly unrelated things such as: 旧的App.config也开始引发关于看似无关的事情的随机警告,例如:

"The simpleType 'small_boolean_Type' has already been declared" “已经声明了simpleType'small_boolean_Type'”

This element isn't present in the config file and pretty much all other warnings similarly reference properties that are not in the config. 该元素不在配置文件中,几乎所有其他警告都类似地引用了不在配置中的属性。

How can I fix the config file after re-targeting my Console Application? 重新定位控制台应用程序后如何修复配置文件?

Create a new config file, by creating a Console Application in Visual Studio that targets .Net 3.5. 通过在Visual Studio中创建针对.Net 3.5的控制台应用程序来创建新的配置文件。 Then copy that config file over to your downgraded project. 然后将该配置文件复制到降级的项目中。 Copy over any app specific settings you need and you should be fine. 复制所需的任何应用程序特定设置,就可以了。

Seemingly, it didn't like the following element I had inside of an endpoint behavior: 看来,它不喜欢端点行为中包含以下元素:

 <webHttp faultExceptionEnabled="true" defaultOutgoingResponseFormat="Json"/>

Removing the node fixed the issue. 删除节点解决了该问题。

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

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