名称:LT; ...>命名空间中的CLR命名空间不存在< ...> [英] the name <...> does not exist in the namespace clr-namespace <...>

查看:1311
本文介绍了名称:LT; ...>命名空间中的CLR命名空间不存在< ...>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用来编译就好了,但现在不是了一个小的WPF应用程序。我真的不能说,到时它停止建设。它只是正常工作一天,接下来的不是这样的。

下面是项目结构:

没有任何其他项目或外部参考比标准.NET的DLL等。

下面是用户控制那里的问题源于:

 <用户控件X:类=TimeRecorder.HistoryUserControl
         的xmlns =htt​​p://schemas.microsoft.com/winfx/2006/xaml/$p$psentation
         的xmlns:X =htt​​p://schemas.microsoft.com/winfx/2006/xaml
         的xmlns:MC =htt​​p://schemas.openxmlformats.org/markup-compatibility/2006
         的xmlns:D =htt​​p://schemas.microsoft.com/ex$p$pssion/blend/2008
         XMLNS:地方=CLR的命名空间:TimeRecorder.ViewModel
         的xmlns:框架=CLR的命名空间:TimeRecorder.Framework
         MC:可忽略=D高度=自动WIDTH =自动填充=5>
< UserControl.Resources>
    <地方:HistoryViewModel X:关键=视图模型/>
    <框架:BoolToColorConverter X:关键=ColorConverter/>
< /UserControl.Resources>
<的StackPanel的DataContext ={的StaticResource视图模型}>
 

这是我得到的错误:

请注意,这不只是在截图的一个文件,但所有引用我加入以类似的方式在XAML中的所有用户控件/窗口文件中的项目。

所以,该文件是存在的,文件中的命名空间是正确的,在XAML文件命名空间/类的名称是(我的理解)是正确的。我得到的IntelliSense当我输入的XAML所以它找到的文件,那么OK,但不是当它编译。<​​/ P>

这在其他职位最常见的解决方案是.NET Framework版本。这是当前设置为.Net框架4为我的主要和测试项目。完整版而不是客户端配置文件。

这就是我想我搞砸了: 在配置管理器,这两个项目都有自己的平台设置为任何CPU,但在试图解决这个问题时,有一点我注意到,主体工程设置为x86和测试项目设置为任何CPU。所以我手动添加任何CPU在配置管理器的主要项目。不过老实说,我不知道我这个正确的或者即使我应该做的那样。因此,作为一个额外的问题,是有办法,我可以重新配置管理器为默认状态?这会不会有什么要说的主要问题?我不知道如果主项目始终设置为86或不和,如果我以某种方式改变了它到了X86,然后就坏了。正如这个项目编译就好了一段时间。

有什么建议?当你问他们,而不是漫无边际就在这里,我会回答关于code或其他更详细的问题:)

解决方案

每一次它的发生给我,我只是重新启动Visual Studio中,重新构建的解决方案和它的工作就好了..不能说为什么

I have a small WPF application which used to compile just fine but is not anymore. I can't really say at which point it stopped building. It just worked fine one day, and the next it's not.

Here's the project structure:

There is no other projects or external references other than standard .net dlls.

Here's the user control where the problem originated:

<UserControl x:Class="TimeRecorder.HistoryUserControl"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         xmlns:local="clr-namespace:TimeRecorder.ViewModel"
         xmlns:framework="clr-namespace:TimeRecorder.Framework"
         mc:Ignorable="d" Height="Auto" Width="Auto" Padding="5">
<UserControl.Resources>
    <local:HistoryViewModel x:Key="ViewModel"/>
    <framework:BoolToColorConverter x:Key="ColorConverter"/>
</UserControl.Resources>
<StackPanel DataContext="{StaticResource ViewModel}">

And here's the error I get:

Please note that this is not just the one file in the screenshot, but all references I add in similar fashion in xaml in all user control/window files in this project.

So the file is there, the namespace in the file is correct, the namespace/class name in the xaml file is (to my understanding) correct. I get intellisense when I type in the xaml so it finds the files ok then but not when it compiles.

The most common solution for this in other posts has been the .net framework version. It is currently set to .Net Framework 4 for both my main and test project. The full version not the client profile.

Here's what I think I messed up: In the configuration manager, both projects have their Platform set to Any CPU, but at one point when trying to solve this I noticed that the main project was set to x86 and the test project was set to Any CPU. So I added Any CPU manually for the main project in the configuration manager. However I honestly don't know if I did this correctly or even if I should do it. So as an additional question, is there a way I can reset the configuration manager to its default state? Will this have anything to say for the main problem? I don't know if the main project was always set to x86 or not or if I somehow changed it to x86 and then it broke. As mentioned this project was compiling just fine for a while.

Any suggestions? I'll answer more detailed questions about code or whatever as you ask them in instead of rambling on here :)

解决方案

Every time it happend to me i just restarted visual studio, re-built the solution and it worked just fine.. can't say why

这篇关于名称:LT; ...&GT;命名空间中的CLR命名空间不存在&LT; ...&GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆