无法解析使用便携式类库组件 [英] Unable to resolve assemblies that use Portable Class Libraries

查看:136
本文介绍了无法解析使用便携式类库组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个最终用户的机器上大会第一个问题,我相信这是与使用便携式类库....

I'm having a problem with assembly resolution on an end-user machine and I believe it's related to using Portable Class Libraries....

我最初写在Visual Studio 2010中我们最近升级到Visual Studio 2012的.NET 4.0应用程序,我们已经创建了一些项目是可移植类库。我不认为我们现在需要这些功能,但我们还构建Windows 8 Store应用程序可能从这些库中受益。

I have a .NET 4.0 application that was originally written in Visual Studio 2010. Recently we upgraded to Visual Studio 2012 and we've created a few projects that are Portable Class Libraries. I don't believe we need these features now, but we're also building a Windows 8 Store application that might benefit from these libraries.

当我编译我的项目,究竟是什么便携式图书馆的功能呢?我希望,它让我无需修改或重新编译在不同的框架中运行它。

When I compile my project, what exactly does the portable library feature do? I expect that it allows me to run it on different frameworks without modification or recompiling.

当我看到在图书馆<打击>反射 dotPeek它显示了平台属性为:

When I look at the library in reflector dotPeek it shows the Platform attribute as:

.NETPortable,版本= V4.0,外形= Profile5

.NETPortable,Version=v4.0,Profile=Profile5

和引用似乎2.0上下的:

And the references seem 2.0-ish:

mscorlib程序,版本= 2.0.5.0

mscorlib, Version=2.0.5.0

系统,版本= 2.0.5.0

System, Version=2.0.5.0

System.Runtime.Serialization,版本= 2.0.5.0

System.Runtime.Serialization, Version=2.0.5.0

当我运行这个最终用户的计算机上的应用程序,我看到在日志文件中的错误:

When I run the application on this end-user's machine, I see an error in the log file:

无法加载文件或程序,System.Core程序,版本= 2.0.5.0 ...

Could not load file or assembly, 'System.Core, Version=2.0.5.0...'

谷歌搜索System.Core程序2.0.5.0似乎是指SilverLight的 - 这似乎是在目标框架之一

Googling System.Core 2.0.5.0 seems to refer to SilverLight -- which appears to be one of the targeted frameworks.

本机没有安装了Visual Studio,但.NET 4.0(4.0.3更新)

This machine does not have Visual Studio installed, but has .NET 4.0 (4.0.3 update)

有什么我应该做不同的编译,这是我应该调查在我的依赖或东西我应该寻找安装在最终用户的机器上?什么是2.0.5.0指什么?

Is there something I should be doing differently to compile, something I should investigate in my dependencies or something I should be looking to install on the end-user machine? What does the 2.0.5.0 refer to?

推荐答案

对于.NET 4,您需要更新(的 KB2468871 )便携式类库工作。从知识库文章

For .NET 4, you need an update (KB2468871) for Portable Class Libraries to work. From the KB Article:

特点5

更改为支持便携式库。这些变化包括API   更新和粘结剂修改。此更新使CLR绑定   成功便携式库,以便单个DLL可以在运行   .NET Framework 4中,在Silverlight中,在Xbox,或在Windows Phone上。   此更新增加了公众的Silverlight API来在.NET Framework 4   相同的位置。该API签名将保持一致跨越   该平台。所有的修改都100%的兼容,   不会破坏任何现有的code。

Changes to the support portable libraries. These changes include API updates and binder modifications. This update enables the CLR to bind successfully to portable libraries so that a single DLL can run on the .NET Framework 4, on Silverlight, on Xbox, or on the Windows Phone. This update adds public Silverlight APIs to the .NET Framework 4 in the same location. The API signatures will remain consistent across the platform. All modifications are 100 percent compatible and will not break any existing code.

另请参阅 MSDN便携式类库文档中的部署.NET框架应用程序一节

编辑:其实,如果机器有你提到安装了.NET 4.0.3,这应该是足够的。你能仔细检查,以确保它实际上是安装?

Actually, if the machine has .NET 4.0.3 installed as you mention, that should be sufficient. Can you double-check to make sure that it is actually installed?

这篇关于无法解析使用便携式类库组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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