app.config 转换为 Visual Studio 2010 / .Net 4.0 后“找不到架构信息”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3173733/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 14:28:50  来源:igfitidea点击:

app.config "Could not find schema information" after converting to Visual Studio 2010 / .Net 4.0

.netvisual-studio-2010xsdapp-config

提问by Walt D

After upgrading my project to Visual Studio 2010 and .Net 4.0, my app.config file generates these messages upon building the project:

将我的项目升级到 Visual Studio 2010 和 .Net 4.0 后,我的 app.config 文件在构建项目时生成以下消息:

  • Could not find schema information for the element 'supportedRuntime'.
  • Could not find schema information for the attribute 'version'.
  • Could not find schema information for the attribute 'sku'.
  • 找不到元素“supportedRuntime”的架构信息。
  • 找不到属性“版本”的架构信息。
  • 找不到属性“sku”的架构信息。

Here is my entire app.config file:

这是我的整个 app.config 文件:

<?xml version="1.0"?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
  </startup>
</configuration>

If I create a new VS2010 project and literally copy/paste the same app.config file, I receive no such messages.

如果我创建一个新的 VS2010 项目并逐字复制/粘贴相同的 app.config 文件,我将不会收到此类消息。

Obviously these messages are not causing any runtime problems, but they are still annoying and disconcerting.

显然,这些消息不会导致任何运行时问题,但它们仍然令人烦恼和不安。

How do I fix whatever problem is making these messages appear?

如何解决使这些消息出现的任何问题?

I see the answer at app.config configSections custom settings can not find schema information, but I see nowhere in the properties list to enter the path to the schema.

我在app.config configSections custom settings can not find schema information看到答案,但我在属性列表中看不到任何地方可以输入架构的路径。

Thanks.

谢谢。

回答by joe

I changed the schema from DotNetConfig to DotNetConfig35 and it took care of the issue. This is available in the properties of the app.config file.

我将架构从 DotNetConfig 更改为 DotNetConfig35,它解决了这个问题。这在 app.config 文件的属性中可用。

Right clicking the app.config file in solution explorer gives the properties of the file, right clicking in the edit window of the app.config file itself gives the properties of the XML document.

在解决方案资源管理器中右键单击 app.config 文件可提供该文件的属性,在 app.config 文件本身的编辑窗口中右键单击可提供 XML 文档的属性。

回答by Ronald Wildenberg

Are you sure the conversion went ok? Maybe the correct target framework wasn't configured. Open your project properties and check if the target framework is actually .NET Framework 4or .NET Framework 4 Client Profile.

你确定转换没问题吗?也许没有配置正确的目标框架。打开你的项目属性,并检查目标框架实际上是.NET Framework 4.NET Framework 4 Client Profile

回答by Nime Cloud

Try to kill the process in Task Manager next time, if it's already running.

下次尝试在任务管理器中终止该进程,如果它已经在运行。

P.S: It might be running at a remote machine.

PS:它可能在远程机器上运行。

Update: Since there is no solution I repeat my advice... Stop down voting. Maybe it's a bug but it might be related to un-terminated debug process. Just examine the Task Manager and kill xyz.vhost.exe of fx2.0, if any.

更新:由于没有解决方案,我重复我的建议......停止投票。也许这是一个错误,但它可能与未终止的调试过程有关。只需检查任务管理器并杀死 fx2.0 的 xyz.vhost.exe(如果有)。

回答by J Zhang

Remove the following section in app.config:

删除 app.config 中的以下部分:

<startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/> 
</startup>