Home > Back-end >  XAML namespace definition containing dots, how can something first be right and afterwards be wrong?
XAML namespace definition containing dots, how can something first be right and afterwards be wrong?

Time:02-23

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

CodePudding user response:

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.

  • Related