逃生&在 App.config 中 [英] Escape & in App.config

查看:30
本文介绍了逃生&在 App.config 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 App.config 文件中有以下配置:

I have the following piece of config in my App.config file:

<add key="ConnectionString" 
     value="INITIAL CATALOG=myDatabase;DATA SOURCE=myServer;User ID=myUser;Password=!&myPass99;"/>

上述连接字符串被 Visual Studio 智能感知拒绝.它说实体 myPass99 未定义.问题是由 &在密码中.

The above connection string is rejected by Visual Studio intellisense. It says entity myPass99 not defined. The problem is caused by the & in the password.

我该如何逃避?

推荐答案

使用 &amp; 代替 &

仅供参考,请参阅此处了解更多字符:我需要转义哪些字符XML 文档?

As an FYI, see here for further characters: What characters do I need to escape in XML documents?

这篇关于逃生&amp;在 App.config 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆