无法在VS2012中构建可移植类库

时间:2012-10-28 16:16:44

标签: reference visual-studio-2012 portable-class-library

我有一个用于在VS2010中构建的项目,现在不会在VS2012中。它的结构如下:

-Lime49 (Portable Class Library)
-Myproject.Shared (Portable Class Library)
--Myproject.Core (.NET4, references the above two libraries)

第一个自己构建好的,但是当我尝试构建第三个时,我得到The type or namespace 'Lime49' could not be found并且控制台显示了这个:

>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3268: The primary reference "Lime49" could not be resolved because it has an indirect dependency on the framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile2". To resolve this problem, either remove the reference "Lime49" or retarget your application to a framework version which contains "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
1>C:\<snipped>\MyProject\trunk\MyProject.Shared\Fraction.cs(11,7,11,13): error CS0246: The type or namespace name 'Lime49' could not be found (are you missing a using directive or an assembly reference?)
1>C:\<snipped>\MyProject\trunk\MyProject.Shared\Nutrition\USDA\USDAUtils.cs(5,7,5,13): error CS0246: The type or namespace name 'Lime49' could not be found (are you missing a using directive or an assembly reference?)
1>C:\<snipped>\MyProject\trunk\MyProject.Shared\UrlHelper.cs(6,7,6,13): error CS0246: The type or namespace name 'Lime49' could not be found (are you missing a using directive or an assembly reference?)
========

我的解决方案中还有两个项目引用了可移植库和.NET 4库,这两个项目都是由于其他人拒绝构建而构建的。我已经尝试删除并重新创建可移植库,但是当从另一个项目引用时它们仍然不会构建。

这就是我在两个可移植类库的框架设置中所拥有的: Framework configuration

1 个答案:

答案 0 :(得分:0)

您声明第3个项目未能构建,但看起来它实际上是第2个项目。从警告消息中可以看出,您正在构建一个实际上是.NET 4.x二进制文件且不可移植的Lime49.dll版本。

您能否确保Lime49 实际上是一个可移植项目,或者您是否构建了以前是.NET 4.x的二进制文件的旧版本?