1
votes

I am trying to install StructureMap.MVC4 for a project, created in Visual Studio 2012, .NET 4.0 and ASP.MVC 4.

But I am getting below error:

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

Any suggestions on what I am missing please!

1

1 Answers

1
votes

Microsoft.AspNet.WebApi.Client 5.1.2 can only be installed into a project that targets .NET 4.5 or is a portable class library. It does not have any assemblies for .NET 4.0.

The latest version of StructureMap 3.0 depends on Microsoft.AspNet.WebApi.Client 5.1.2 so if you want to that the latest version of StructureMap 3.0 you would need to change your project so it targets .NET 4.5.

Older versions of StructureMap.MVC4 may work with .NET 4.0. Version 2.6.4.3 for example depends on an older version of Microsoft.AspNet.WebApi which supports .NET 4.0. Even older versions of StructureMap.MVC4, such as 2.2.0 do not depend on Microsoft.AspNet.WebApi.