Asp.net Webdeployment 项目覆盖 applicationSettings

发布于 2024-08-23 02:57:32 字数 912 浏览 5 评论 0原文

我在 vs 2008 中获得了一个用于 Web 应用程序项目的 Web 部署项目。 在构建 Web 部署项目时,我想替换 web.config 中的属性。

我的设置是由设计者自动生成的。

<applicationSettings>
 <NAMESPACE.Properties.Settings>
   <setting name="Testenvironment" serializeAs="String">
    <value>True</value>
   </setting>

  </NAMESPACE.Properties.Settings>
</applicationSettings>

在包含特定服务器设置的配置文件中,如下所示:

<?xml version="1.0"?>
<applicationSettings>
    <NAMESPACE.Properties.Settings>
       <setting name="Testenvironment" serializeAs="String">
        <value>False</value>
       </setting>
    </NAMESPACE.Properties.Settings>
</applicationSettings>

遗憾的是,这不起作用。我收到错误“configSource 文件的格式必须是包含部分名称的元素”,突出显示第二行(第二个示例代码)。

标签必须如何命名才能使一切正常工作?

编辑:删除“applicationSetting”标签也不起作用。

I got a web deyploment project for a web application project in vs 2008.
While building the web deployment project, I want to replace properties in the web.config.

My settings are autogenrated by the deisgner.

<applicationSettings>
 <NAMESPACE.Properties.Settings>
   <setting name="Testenvironment" serializeAs="String">
    <value>True</value>
   </setting>

  </NAMESPACE.Properties.Settings>
</applicationSettings>

In the config file which contains the settings for the specific server looks like the following:

<?xml version="1.0"?>
<applicationSettings>
    <NAMESPACE.Properties.Settings>
       <setting name="Testenvironment" serializeAs="String">
        <value>False</value>
       </setting>
    </NAMESPACE.Properties.Settings>
</applicationSettings>

Sadly, this does not work. I get an error "The format of a configSource file must be an element containing the name of the section" that highlights the second line (2nd example code).

How must the Tag be named in order to make evertything work?

Edit: Deleting the "applicationSetting"-Tags does not work either.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

辞旧 2024-08-30 02:57:32

找到问题/解决方案:

在网络部署项目中我说的是,

appSettings=FILENAME.config

而不是

applicationSettings/NAMESPACE.Properties.Settings=FILENAME.config

现在工作正常

Found the problem/solution:

In the web deployment project I said that

appSettings=FILENAME.config

rather than

applicationSettings/NAMESPACE.Properties.Settings=FILENAME.config

Works fine now

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文