使用 .NET 4 的 WPF 中的 Sketchable,无法加载 System.Core 版本=2.0.5.0
Sketchflow 新手(几天),WPF 新手(几周)。
工作区详细信息:
WinXP、Visual Studio 2010 Ultimate、Expression Studio Ultimate(使用带有 SketchFlow 的 Expression Blend 4)。下载了 Sketchables 0.9 版本 并构建了发布版本(调试版本已经建成)。
问题详细信息:
启动 Expression Blend 4,创建 WPF Sketchflow 项目。构建它(成功)。添加对 Sketchables 库的发布版本或调试版本(在桌面中,而不是 SL 文件夹中)的引用,然后尝试再次构建。构建失败并出现错误:
Unknown build error, 'Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXX' or ore of its dependencies. The local assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'
现在,我看到了一些具有类似错误的问题,特别是由于尝试在 WPF 项目中加载 Silverlight 控件而导致的几个问题。但是,我的知识不够,不知道它是否相关。凭着直觉,我尝试了一个 Silverlight 项目。果然,构建 Silverlight Sketchflow 项目并添加 Sketchables 库就可以干净地构建。
所以,问题是这样的:有谁知道 Sketchables 源代码中实际导致此错误的原因是什么,以及如何跟踪它以便我可以对其进行处理并为 WPF 构建一个干净的库吗?< /强>
Sketchflow newbie (couple days), WPF newbie (few weeks).
Workspace details:
WinXP, Visual Studio 2010 Ultimate, Expression Studio Ultimate (using Expression Blend 4 with SketchFlow). Downloaded the Sketchables 0.9 release and built a release version (Debug version is already built).
Issue details:
Start up Expression Blend 4, create a WPF Sketchflow project. Build it (successful). Add references to either the release or debug versions of the Sketchables library (in the Desktop, rather than the SL folder) and try to build again. The build fails with error:
Unknown build error, 'Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXX' or ore of its dependencies. The local assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'
Now, I've seen some issues with a similar error, specifically a couple of issues where the problem was caused by trying to load a Silverlight control in a WPF project. However, I'm not knowledgeable enough to know if it's related. On a hunch, I tried a Silverlight project. Sure enough, building a Silverlight Sketchflow project and adding the Sketchables library builds cleanly.
So, the question is this: Does anyone have any ideas about what's actually causing this error within the Sketchables source, on pointers on how to track it down so I can work on it and get a clean library build for WPF?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查克是对的。 Sketchables.Common dll 是一个Silverlight 类库。简单的修复方法是创建一个 Sketchables.Common.WPF 项目并将其设为常规类库。从 SL 库项目复制类,编译,然后更改 Sketchables.WPF 中的引用以指向 Sketchables.Common.WPF 而不是 Sketchables.Common。您的 Blend 项目现在应该构建了。
更高级的方法是将两个 Common 项目共享到相同的文件,但我不会在这里讨论。搜索项目之间的共享(链接)文件,您将找到答案。
Chuck's right. The Sketchables.Common dll is a Silverlight class library. Easy way to fix is to create a Sketchables.Common.WPF project and make it a regular class library. Copy over the classes from the SL library project, compile, and then change the reference in Sketchables.WPF to point to Sketchables.Common.WPF instead of Sketchables.Common. Your Blend project should now build.
A more advanced way is to share both Common projects to same files, but I won't go into that here. Search for share (link) files between projects and you'll find answers for that.
您已经确定了问题的原因,您尝试在 WPF 项目中引用的程序集是为 Silverlight 编译的(2.0.5.0 版本号表明它是 Siverlight)。
您可能需要咨询控件的作者,看看是否有办法为 WPF 编译它。
You have identified the cause of the problem, the assembly you are trying to reference in your WPF project was compiled for Silverlight (the 2.0.5.0 version number is a giveaway that it is Siverlight).
You might want to check with the author of the controls to see if there is a way to compile it for WPF.