我在Visual Studio 2012 Express Edition中做了一些工作。我添加了一个App.config XML文件,如下所示:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
</configuration>
发生的第一件事是出现警告“未声明''配置'元素”。有谁知道为什么会这样?在解决此问题之前,看起来元素无法在其中声明。
谢谢!
这是整个XML:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="Version" value="779" />
<add key="TimeOut" value="60000" />
<add key="LogFileName" value="Log.txt" />
<!-- your Developer Id with eBay -->
<add key="Environment.DevId" value="" />
<!-- your Application Id with eBay -->
<add key="Environment.AppId" value="" />
<!-- your Application Certificate with eBay -->
<add key="Environment.CertId" value="" />
<!-- API Server URL -->
<!-- For production site use: https://api.ebay.com/wsapi -->
<!-- For Sandbox use: https://api.sandbox.ebay.com/wsapi -->
<add key="Environment.ApiServerUrl" value="https://api.sandbox.ebay.com/wsapi" />
<!-- EPS Server URL -->
<!-- For production site use: https://api.ebay.com/ws/api.dll"/-->
<add key="Environment.EpsServerUrl" value="https://api.sandbox.ebay.com/ws/api.dll" />
<!-- eBay Signin URL -->
<!-- For production site use: https://signin.ebay.com/ws/eBayISAPI.dll?SignIn -->
<!-- https://signin.sandbox.ebay.com/ws/eBayISAPI.dll?SignIn -->
<add key="Environment.SignInUrl" value="https://signin.sandbox.ebay.com/ws/eBayISAPI.dll?SignIn" />
<!-- ViewItem URL -->
<!-- For production site use: http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item={0} -->
<add key="Environment.ViewItemUrl" value="http://cgi.sandbox.ebay.com/ws/eBayISAPI.dll?ViewItem&item={0}" />
<!-- token is for both API server and EPS server -->
<add key="UserAccount.ApiToken" value="" />
<!-- eBay site ID -->
<add key="UserAccount.eBayUserSiteId" value="0" />
<add key="logexception" value="true"/>
<add key="logmessages" value="true"/>
<add key="logsdkmessages" value="true"/>
<add key="logsdk" value="true"/>
<add key="logfile" value="Log.txt"/>
<!-- Rule Name-->
<add key="RuName" value=""/>
<!-- Set this if you access eBay API server behind a proxy server-->
<add key="Proxy.Host" value =""/>
<add key="Proxy.Port" value =""/>
<!-- set proxy server username/password if necessary-->
<add key="Proxy.Username" value=""/>
<add key="Proxy.Password" value=""/>
我遇到过同样的问题。这不是一个错误,它只是一个警告;所以你的应用程序仍应编译。我使用了以下简单的配置文件,仍然会生成警告。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime
version="v4.0"sku=".NETFramework,
Version=v4.5"/>
</startup>
</configuration>
这是MSDN网站上提出的一个问题,但它似乎没有得到令人满意的解决。见以下链接:
<configuration xmlns="schema URL">
<!-- configuration settings -->
</configuration>
做一些变化,如上所述并尝试
我不得不 - >转到XML菜单(visual studio顶部菜单项)选择模式并选择DotNetConfig.xsd和RazorCustomSchema.xsd AND EntityFrameworkConfig_6_1_0.xsd
我在处理xaml项目时,在自动生成的xml文件中只有这个警告弹出窗口。
使用Debug-> Clean Solution和Debug-> Rebuild Solution修复它。可能想在尝试使用模式之前尝试一下。
Visual Studio 2013 Express Edition缺少DotNetConfig.xsd(https://connect.microsoft.com/VisualStudio/feedback/details/817322/dotnetconfig-xsd-files-not-present-in-vs-2013-express-for-desktop)。
所以要摆脱VS 2013 Express中的警告:
警告应该消失了。
选择使用此架构。 DotNetConfig.xsd
XLM菜单...... Visual Studio
完美的工作。
我的驱动器空间较小,可能导致我的应用程序解决方案加载不完整。在我的驱动器上创建了一些空间后,这个“配置元素未声明”的问题得到了解决。