本文介绍了这个名字与QUOT; XYZ"命名空间中的&QUOT不存在; CLR命名空间:ABC"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是在创造一些标记扩展工作,并开始得到VS行为很怪异。我已提取并在分开溶液精确定位的问题。问题是,VS不能创建XAML中的CLR对象。

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.

下面是:

查看:

<Window x:Class="WpfApplication4.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:wpfApplication4="clr-namespace:WpfApplication4">
    <Window.Resources>
        <wpfApplication4:Dog x:Key="doggy" />
    </Window.Resources>
    <Grid />
</Window>

后面的 code:

using System.Windows;

namespace WpfApplication4
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
    }
}

狗类:

namespace WpfApplication4
{
    public class Dog
    {

    }
}

的App.xaml(在App.Xaml.cs没有code):

<Application x:Class="WpfApplication4.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <Application.Resources>

    </Application.Resources>
</Application>

例外我得到:

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" errorAny ideas?

修改

我运行VS 2012更新2
在VS 2012 Update 1中相同的解决方案的工作

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

推荐答案

您解决方案是在网络共享上运行。 .NET(和Visual Studio)的应用程序可以在网络共享上运行时,碰上许可/准入问题。

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到UNC共享为Visual Studio 2012和.NET 4.0

我只曾与VS2010使(如链接所示)则可能有更好的喜悦2012试过这个。

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

这篇关于这个名字与QUOT; XYZ&QUOT;命名空间中的&QUOT不存在; CLR命名空间:ABC&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 00:58