gpt4 book ai didi

.net - app.config 创建和读取部分的问题

转载 作者:行者123 更新时间:2023-12-02 02:18:24 24 4
gpt4 key购买 nike

我一直在尝试通过此示例使用 app.config 部分:

http://msdn.microsoft.com/en-us/library/system.configuration.configurationcollectionattribute.aspx#Y2391

它给了我下一个异常(exception):

为 MyUrls 创建配置节处理程序时发生错误:
无法加载文件或程序集“ConfigurationCollectionAttribute,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null”或其依赖项之一。该系统找不到指定的文件。 (E:\Projects\AppConfigSectionsTesting\AppConfigSectionsTesting\bin\Debug\AppConfigSectionsTesting.vshost.exe.Config 第 4 行)

这是配置文件 -

   <?xml version="1.0" encoding="utf-8" ?>
<configuration>

<configSections>
<section name="MyFolders" type="FoldersSection,
ConfigurationCollectionAttribute, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</configSections>
<MyFolders>
<Folders>
<add Path ="D:\\RUN"/>
</Folders>
</MyFolders>

</configuration>

我不明白为什么......任何人都可以帮忙吗?谢谢。

最佳答案

在您的 app.config 中,检查您是否拥有类 ConfigurationCollectionAttribute 的完整命名空间

例如:

<configSections>
<section name="configSectionName"
type="Company.Namespace.ConfigSection, Company.Namespace" />
</configSections>

关于.net - app.config 创建和读取部分的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7347403/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com