Problems reinstalling nuget packages when target framework changed

We saw this error when trying to reinstall nuget packages on one application:

Successfully uninstalled ‘Microsoft.AspNet.WebApi.Client 5.0.0’.
Install failed. Rolling back…
update-package : Could not install package ‘Microsoft.AspNet.WebApi.Client 5.0.0’. 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:1
+ update-package -project Walshgroup.Web.CorporateExperience.vbproj -reinstall
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Update-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.UpdatePackageCommand

 

This was caused by us installing this nuget package initially when the project was targeting .net 4.5, and then later it was changed to target .net 4.0. 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s