I've been working on a WPF application. Since I design the UI in Expression Blend 4 and work on the code-behind part in Visual Studio 2010, I constantly switch from one tool to another.
我一直在开发一个WPF应用程序。由于我在Expression Blend 4中设计UI,并在Visual Studio 2010中处理代码隐藏部分,所以我不断地从一个工具切换到另一个工具。
I added some Image controls to an existing Grid and assigned some images to them. In Blend, I built the project and ran it. Worked just fine. When I switched to Visual Studio, I am getting this error:
我在现有的网格中添加了一些图像控件,并给它们分配了一些图像。在Blend中,我构建了这个项目并运行它。工作得很好。当我切换到Visual Studio时,我得到了这个错误:
Undefined CLR namespace. The 'clr-namespace' URI refers to a namespace 'MS.Internal.Media' that is not included in the assembly. C:\Users\Dennis\Documents\Visual Studio 2010\Projects\solutionName\projectName\MainWindow.xaml
未定义的CLR命名空间。“clr-namespace”URI指的是“内部”的名称空间。“不包括在大会中的媒体”。C:\Users\Dennis\Documents\Visual Studio 2010 \ \ solutionName \ projectName \ MainWindow.xaml项目
The designer cannot be loaded with this error pending. However, the project is working in Blend and I can see it just fine there.
设计器不能加载此错误。但是,这个项目正在使用Blend,我可以看到它很好。
The declarations are the following (in the Window):
声明如下(窗口):
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:MS_Internal_Media="clr-namespace:MS.Internal.Media;assembly=PresentationCore" mc:Ignorable="d" x:Class="projectName.MainWindow"
Height="272" Width="359" Loaded="Window_Loaded" WindowStyle="ThreeDBorderWindow" ResizeMode="NoResize" Icon="/projectName;component/Images/main.ico"
Title="Sample Project">
What could be causing this error?
是什么导致了这个错误?
1 个解决方案
#1
1
It seems that this is a known issue (perhaps bug is too strong a word, if it is a setting or something that I am missing too then happy to stand corrected on this one, anyway....) in Visual Studio - its still happening in VS2010 too.
看来,这是一个已知的问题(也许错误”一词太强烈,如果它是一个设置什么的我也失踪那么乐于认错,不管怎样....)在Visual Studio在VS2010——它仍然发生。
If you remove the string "clr-namespace:" in the XAML, just leaving you with
如果您在XAML中删除了字符串“clr-namespace:”,那么只留下一个
xmlns:MS_Internal_Media="MS.Internal.Media;assembly=PresentationCore"
it will compile fine and you can reload the designer. If you then added the clr-namespace syntax in again it will build ok but the designer will still error. I believe this must be an issue in Visual Studio itself.
它将编译良好,您可以重新加载设计器。如果您再次添加clr命名空间语法,它将构建ok,但是设计器仍然会出错。我相信这一定是Visual Studio本身的问题。
Hope this workaround at least helps you to load the designer and get the project built.
希望这个解决方案至少能帮助您加载设计器并构建项目。
Having played around with this a little more I think the problem is probably the fact that that assembly has no public types. Looking at the assembly in .Net Reflector they are all internal classes. The same error that you are getting in VS is thrown for all assemblies where thare are no public types. I expect that Blends interface is either not checking for this or is handling it better.
考虑到这个问题,我认为问题可能在于大会没有公共类型。看看。net Reflector中的程序集,它们都是内部类。在VS中遇到的相同错误是对所有没有公共类型的程序集抛出的。我希望blend接口不是没有检查这个,就是处理得更好。
#1
1
It seems that this is a known issue (perhaps bug is too strong a word, if it is a setting or something that I am missing too then happy to stand corrected on this one, anyway....) in Visual Studio - its still happening in VS2010 too.
看来,这是一个已知的问题(也许错误”一词太强烈,如果它是一个设置什么的我也失踪那么乐于认错,不管怎样....)在Visual Studio在VS2010——它仍然发生。
If you remove the string "clr-namespace:" in the XAML, just leaving you with
如果您在XAML中删除了字符串“clr-namespace:”,那么只留下一个
xmlns:MS_Internal_Media="MS.Internal.Media;assembly=PresentationCore"
it will compile fine and you can reload the designer. If you then added the clr-namespace syntax in again it will build ok but the designer will still error. I believe this must be an issue in Visual Studio itself.
它将编译良好,您可以重新加载设计器。如果您再次添加clr命名空间语法,它将构建ok,但是设计器仍然会出错。我相信这一定是Visual Studio本身的问题。
Hope this workaround at least helps you to load the designer and get the project built.
希望这个解决方案至少能帮助您加载设计器并构建项目。
Having played around with this a little more I think the problem is probably the fact that that assembly has no public types. Looking at the assembly in .Net Reflector they are all internal classes. The same error that you are getting in VS is thrown for all assemblies where thare are no public types. I expect that Blends interface is either not checking for this or is handling it better.
考虑到这个问题,我认为问题可能在于大会没有公共类型。看看。net Reflector中的程序集,它们都是内部类。在VS中遇到的相同错误是对所有没有公共类型的程序集抛出的。我希望blend接口不是没有检查这个,就是处理得更好。