无法在 .NET 4、MVC 4、VS 2012 上安装 StructureMap.MVC4

Unable to install StructureMap.MVC4 on .NET 4, MVC 4, VS 2012

我正在尝试为 Visual Studio 2012 年创建的项目安装 StructureMap.MVC4,.NET 4.0 和 ASP.MVC 4.

但我遇到以下错误:

Could not install package 'Microsoft.AspNet.WebApi.Client 5.1.2'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. At line:1 char:16 + install-package <<<< structuremap.mvc4 WebApi_StructureMap_DotNet4 + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

请就我遗漏的内容提出任何建议!

Microsoft.AspNet.WebApi.Client 5.1.2 只能安装到以 .NET 4.5 为目标的项目中或者是可移植的 class 库。它没有任何适用于 .NET 4.0 的程序集。

最新版本的 StructureMap 3.0 依赖于 Microsoft.AspNet.WebApi.Client 5.1.2,因此如果您想要最新版本的 StructureMap 3.0,您需要更改您的项目,使其以 .NET 4.5 为目标。

旧版本的 StructureMap.MVC4 可能适用于 .NET 4.0。例如,版本 2.6.4.3 依赖于支持 .NET 4.0 的旧版本 Microsoft.AspNet.WebApi。即使是 StructureMap.MVC4 的旧版本,例如 2.2.0 也不依赖于 Microsoft.AspNet.WebApi.