I get the following error trying to use the String type in xaml:
XLS0419 Undefined CLR namespace. The 'clr-namespace' URI refers to a namespace 'System' that could not be found.
Here is the code:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:markup="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:system="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="options">
<!-- Matadata -->
<system:String x:Key="Theme.Name">Dark.Blue</system:String>
The line 'xmlns:system="clr-namespace:System;assembly=mscorlib"' is the location of the error. I have simply copied this code from another file in another project in the solution, and the code works fine there. I have no idea how to resolve this.
I have tried shutting down Visual Studio and restarting the computer.
Your markup should compile just fine on both .NET Framework and .NET Core but if you target the latter and have issues with squiggly lines in Visual Studio, you could change the namespace declaration to this:
xmlns:system="clr-namespace:System;assembly=System.Runtime"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With