我真的在这里撞墙。首先,一些背景。该应用程序是使用WPF棱镜4/MVVM应用程序,我的解决方案结构如下:在另一个程序集中查找合并资源字典时出错
MyCompany.MyProduct (MyCompany.MyProduct.exe)
+-- Shell.xaml
Shell.xaml.cs
app.config
(etc)
MyCompany.MyProduct.Infrastructure (MyCompany.MyProduct.Infrastructure.dll)
+-- Resources
| +-- MyApplicationStyles.xaml
| SuperCoolImage.png
| (etc)
+-- BaseClasses
+-- ViewModelBase.cs
(etc)
MyCompany.MyProduct.Modules.ModuleA (MyCompany.MyProduct.Modules.ModuleA.dll)
+-- ViewModels
| +-- StuffViewModel.cs
| (etc)
+-- Views
+-- StuffView.xaml
StuffView.xaml.cs
(etc)
项目引用:
- MyCompany.MyProduct引用 MyCompany.MyProduct.Infrastructure
- MyCompany的。 MyProduct.Modules.ModuleA 引用 MyCompany.MyProduct.Infrastructure
现在,在这两个Shell.xaml和StuffView.xaml,我包括合并字典这样:
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary
Source="pack://application:,,,/MyCompany.MyProduct.Infrastructure;component/Resources/MyApplicationStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
在这两种情况下,但是,我正在头先入以下错误:
Could not load file or assembly 'MyCompany.MyProduct.Infrastructure, Culture=neutral' or one of its dependencies. The system cannot find the file specified.
(叹气)我也注意到XAML编辑器显示我在此线两条弯弯曲曲的错误:
<ResourceDictionary Source="pack://application:,,,/MyCompany.MyProduct.Infrastructure;component/Resources/MyApplicationStyles.xaml"/>
第一个波浪的错误是...
An error occurred while finding the resource dictionary "pack://application:,,,/MyCompany.MyProduct.Infrastrucuture;component/Resources/MyApplicationStyles.xaml".
第二个(一个更加好奇)弯弯曲曲的错误是...
"Assembly name expected instead of project name."
因此,这里是我已经试过:
- 我三重检查,该项目存在引用(我已删除并重新添加它们)
- 我检查过MyCompany.MyProduct.Infrastructure构建成功
- 我已仔细检查程序集是否正确T(通过的AssemblyInfo.cs)
- 我已经改变了对MyApplicationStyles.xaml时间生成操作,并再次(它目前设置为“页”)
- 我手动清洗液和重建
- 我VE重新启动Visual Studio中的几次
- 我已经牺牲了山羊(也没关系......他是一个非常不友好的山羊)
我的想法和搜索被转动起来非常小。有任何想法吗?
在MyCompany.MyProduct.Infrastructure中仔细检查您的名称空间和程序集名称 – 2012-07-11 05:29:22