Is there any way to reference (in XAML) an assembly with spaces in its name?
Is it not possible to reference an assembly that has spaces in its name? Do I really have to rename my assemblies to not contain spaces? Is there no way to escape the spaces? I can't find very many instances of people who have this problem, let alone any solutions...
Example XAML:
<UserControl x:Class="SomeClass"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Some开发者_如何转开发.Namespace;assembly=Some Assembly With Spaces In The Name"
>
And this is the error that the compiler gives you when you try to do this:
Unknown build error, ''clr-namespace:Some.Namespace;assembly=Some Assembly With Spaces In The Name' mapping URI is not valid. Line 4 Position 2.'
Putting ' or " around the assembly name doesn't help.
This solution seems to have fixed the issue for me with spaces in the assembly name.
This looks like the bug you're referring to, which is 'fixed'...
I've just had a similar problem with a ValueConverter in a separate assembly, and the way to get it to build was to include a default constructor in my ValueConverter class. Without that, VS won't build it if it's contained in an assembly with spaces in the name.
Unfortunately, it builds but then falls over with a XamlParseException
when I actually run it up.
If I do the same referencing an assembly without spaces, everything is fine.
As an aside, you're defining the xmlns:local
namespace but referencing a different assembly - if your namespace is indeed local you can just do:
<xmlns:local="clr-namespace:Some.Namespace"/>
精彩评论