Upgrade to .Net 4.5 causes assembly to fail?
我有一个面向.NET 4.0的项目,其中一个引用的程序集是.NET 4.5。
在我安装.NET 4.5之前,这是正常工作的,但是在安装之后,我会收到五条关于.NET目标版本的警告,这些警告是沿着以下行:
*The primary reference"xxxx.Library, Version=1.0.0.1, Culture=neutral, processorArchitecture=MSIL" could not be resolved
because it was built against the".NETFramework,Version=v4.5"
framework. This is a higher version than the currently targeted
framework".NETFramework,Version=v4.0"
而这:
The primary reference"Microsoft.TeamFoundation.Build.Workflow, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a,
processorArchitecture=MSIL" could not be resolved because it has an
indirect dependency on the framework assembly"System.IO.Compression,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
which could not be resolved in the currently targeted framework.
".NETFramework,Version=v4.0". To resolve this problem, either remove
the reference"Microsoft.TeamFoundation.Build.Workflow,
Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a,
processorArchitecture=MSIL" or retarget your application to a
framework version which contains"System.IO.Compression,
Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089". Tests
为什么Visual Studio讨厌我?如果它可以在更新到4.5之前编译,那么目标框架没有改变,它仍然适用于VS2010和.NET 4的同事,为什么我会被填满?
错误消息解释了问题-.NET 4应用程序无法引用.NET 4.5 dll。也可以将应用程序更改为.NET 4.5,或者将DLL更改回.NET 4。
这是因为出于Microsoft最熟悉的原因,.NET Framework 4.5是一个就地更新,取代了.NET Framework 4文件(而不是并行安装)。如果在c:windowsmicrosoft.net中查找,将找不到4.5文件夹--它替换了4.0文件夹中的文件。
所以它以前编译的原因是当时的dll是.NET 4.0 dll。现在它被一个4.5的取代了。