Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom WPF namespace mappings failing in Visual Studio 2010

I just installed Visual Studio 2010 and converted one of my Visual Studio 2008 WPF projects over for testing. While the project builds and runs correctly, the VS Designer cannot handle the custom namespace mappings I have giving the error:

Assembly must be specified for XAML files that are not part of a project. Reopen this XAML file after adding it to a project, close this file and reopen it using the project it is associated with, or modify the clr-namespace to include the name of the assembly.

The namespaces in question are part of the project. Visual Studio 2008 had no problems with the XAML. So I created a new blank WPF project called Test1 with the namespace being Test1. I then edited the generated MainWindow.xaml to add a single mapping for local:

<Window x:Class="Test1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Test1"
    Title="MainWindow" Height="350" Width="525">
    <Grid />
</Window>

This gives the same error. And, amazingly, Google reports no results for the error! I tried a few variations such as appending ;assembly= or ;assembly=Test1, but that did not help.

Can anyone spot what I'm doing wrong? If nothing, I'd greatly appreciate suggestions for why this may be failing.

Edit: As per the comments, it turns out that this only occurs when the project is opened from a networked share. It does not occur if the project is opened on a local drive. I would like, however, to be able to open it on the network share so I'm going to leave the question open.

like image 581
Gregyski Avatar asked May 28 '10 02:05

Gregyski


People also ask

What is CLR namespace in WPF?

clr-namespace: The CLR namespace declared within the assembly that contains the public types to expose as elements. assembly= The assembly that contains some or all of the referenced CLR namespace. This value is typically just the name of the assembly, not the path, and does not include the extension (such as .

What is MC ignorable D?

The mc:Ignorable namespace provides xaml definitions that are "ignored" by the xaml processor. This allows you to specify information used by the designer at design time which is ignored at runtime.

Which attribute in WPF reference the XAML namespace?

XAML namespaces use the standard XMLNS attribute to define the namespace. They use unique names via URIs. They also can use namespace prefixes which provide a means to reference multiple namespaces from the same markup source.

Does not exist in XML namespace?

To resolve the error “The tag does not exist in XML namespace” in WPF application, need to ensure whether the Target framework of an application and Target framework of a referred Syncfusion assemblies are of same version.


2 Answers

Neil Allen is right. Map the folder as drive and all will be fine. How to map: http://www.online-tech-tips.com/computer-tips/how-to-map-a-drive-in-windows/

like image 187
Cyclion Avatar answered Oct 01 '22 09:10

Cyclion


I’ve had the same problem but I found using a mapped drive letter instead of the UNC path works for me.

Regards

Neil Allen

like image 28
Neil Allen Avatar answered Oct 01 '22 09:10

Neil Allen