Vitalij Vitalij - 1 year ago 137
C# Question

The name "XYZ" does not exist in the namespace "clr-namespace:ABC"

I was working on creating some markup extensions and started to get very weird VS behaviours. I have extracted and pinpointed the issue in the separate solution. Problem is that VS can't create a CLR object in XAML.

Here it is:


<Window x:Class="WpfApplication4.MainWindow"
<wpfApplication4:Dog x:Key="doggy" />
<Grid />

Code behind:

using System.Windows;

namespace WpfApplication4
public partial class MainWindow : Window
public MainWindow()

Dog class:

namespace WpfApplication4
public class Dog


App.Xaml (no code in App.Xaml.cs):

<Application x:Class="WpfApplication4.App"


Project settings

Exception I am getting:

Error 1 The name "Dog" does not exist in the namespace "clr-namespace:WpfApplication4". \\hopr1\folders$\vxk\Documents\Visual Studio 2012\Projects\WpfApplication4\MainWindow.xaml 6 9 WpfApplication4

I am able to run solution, but designer fails with "Invalid Markup" error
Any ideas?


I am running VS 2012 Update 2
The same solution work in VS 2012 Update 1

Answer Source

Your solution is running on a network share. .Net (and Visual Studio) applications can run into permission / access issues when running on a network share.

Copy your solution to a local drive (with full trust) and you should be fine.

It is possible to get a network drive working with full trust - you can find answers for this on StackOverflow and other places - but in my experience I keep running into obstacles when I do this, so try to avoid it unless it's absolutely critical to the problem at hand.

E.g. this question gives instructions about how to do this:

Give FullTrust to UNC share for Visual Studio 2012 and .Net 4.0

I've only ever tried this with VS2010 so (as indicated in the link) you might have better joy with 2012.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download