问题描述
我正在尝试使用Blend 3.0编辑包含某些WPF控件的项目.该项目已经可以在Visual Studio 2008中编译并正常运行.
I am trying to use Blend 3.0 to edit a project that contains some WPF controls. This project already compiles and runs fine from Visual Studio 2008.
但是,在Blend中,我收到了毫无意义的神秘错误:
In Blend however, I'm getting mysterious errors that make no sense:
例如,我有一个派生自Control的类:
For example, I have a class that derives from Control :
namespace Company.WPFControls.SearchTextBox
{
public class SearchTextBox : Control
{
...
}
}
然后我尝试在同一程序集中的资源中使用它来分配样式:
And I try to use it in a resource, in the same assembly, to assign a style:
<ResourceDictionary
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:local="clr-namespace:Company.WPFControls.SearchTextBox"
<Style TargetType="{x:Type local:SearchTextBox}">
...
</Style>
</ResourceDictionary>
在Blend中出现以下错误:
I get the following error in Blend:
我尝试通过添加;assembly=Company.WPFControls
来指定程序集名称,但它不能消除错误.
I've tried specifying the assembly name, by adding ;assembly=Company.WPFControls
but it doesn't remove the error.
有什么办法可以解决此问题,或者至少可以找出问题的根源?
Is there any way to fix this or at least figure out where the problem comes from?
推荐答案
在Windows Vista 64上,我在Blend 2上遇到了同样的问题.
I had the same problem with Blend 2, on a Windows Vista 64.
我通常在VS2008中编译我的解决方案,并在所有项目中使用"Debug-x86"目标,以便它与其他一些仅32位的项目兼容.
I normally compile my solution in VS2008, with a "Debug - x86" target on all my projects, so that it's compatible with some other 32 bits-only projects.
Blend似乎喜欢调试-任何CPU"目标.我基本上改变了配置管理器,使其针对任何CPU平台而不是x86.
It looks like Blend loves the "Debug - Any CPU" targets.I basically changed my configuration manager so that it targets Any CPU platforms instead of x86.
所以...
- 在Blend和VS2008中打开您的解决方案
- 在VS2008中,选择菜单Build->配置管理器
- 确保您的解决方案配置具有调试-任何CPU"适用于所有项目
- 在VS2008中编译
- tadaaaa 您的Blend项目应更新并删除这些错误...对我来说很好
- Open your solution in Blend and in VS2008
- In VS2008, choose the menu Build ->Configuration Manager
- Ensure that your solutionconfiguration has a "Debug - Any CPU"for all projects
- Compile in VS2008
- tadaaaa Your blend project should update and remove those errors...well it did for me
我做了相反的工作来验证它是否确实如此,看来是的……我只是将解决方案更改恢复为Debug-x86,清理了所有内容,然后重新构建,而我仍然返回错误消息"Does不存在[...]"
I did the opposite to verify if it was really that, and it seems yes... I simply reverted the solution changes back to Debug - x86, cleaned everything, and rebuilded, and I was still back with the error "Does not exist [...]"
至于为什么?" ...我不知道,但至少现在可以了!
As for the "Why?"... I don't know, but at least it works now!
这篇关于Expression Blend:收到错误"XXX"在名称空间"XXX"中不存在,但在VS2008中不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!