XAML 命名空间定义包含点,怎么可能先是正确的,然后又是错误的呢?
我有以下 XAML 文件:
<client:View ...
...
xmlns:Product.Project1.Client="clr-namespace:Product.Project1.Client.Controls;assembly=Product.Project1.Client"
...
在 Visual Studio 中,此行被禁用(变灰),我得到提示,说这不是有效的 XAML 名称,但当我尝试构建时,没有问题。
但是,然后我添加了类似的行:
<client:View ...
...
xmlns:Product.Project2.Client="clr-namespace:Product.Project2.Client.Controls;assembly=Product.Project2.Client"
xmlns:Product.Project1.Client="clr-namespace:Product.Project1.Client.Controls;assembly=Product.Project1.Client"
这些行再次被禁用(变灰),我得到提示,说这不是有效的 XAML 名称,但这一次,当我编译时,我收到两个 XLS0412 错误,指出提到的行不是有效的 XAML 名称。
我正在向现有项目添加一些内容,所以我想知道如何首先成功编译但下次失败。有人有想法吗?
提前致谢
I have the following XAML file:
<client:View ...
...
xmlns:Product.Project1.Client="clr-namespace:Product.Project1.Client.Controls;assembly=Product.Project1.Client"
...
In Visual Studio, this line gets disabled (greyed out), I get a hint, saying that this is not a valid XAML name, but when I try to build, no problem.
However, then I add a similar line:
<client:View ...
...
xmlns:Product.Project2.Client="clr-namespace:Product.Project2.Client.Controls;assembly=Product.Project2.Client"
xmlns:Product.Project1.Client="clr-namespace:Product.Project1.Client.Controls;assembly=Product.Project1.Client"
Again these line get disabled (greyed out), I get a hint, saying that this is not a valid XAML name, but this time, when I compile, I get two XLS0412 errors, saying that the mentioned lines are not valid XAML names.
I'm in the process of adding something to an existing project, so I'd like to know how this can compile successfully first but then fail a next time. Does anybody have an idea?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该问题是由于代码行
Product.Project2.Client
内的点引起的。替换特殊字符将解决您的问题,例如
ProductProject2Client
或如您所提到的:Product_Project2_Client
。The problem is due to the dot inside the codeline
Product.Project2.Client
.Replacing the Special Character will solve your issue, e.g.
ProductProject2Client
or as you mentioned:Product_Project2_Client
.