Nuget Package restore issues

After upgrading Nuget on VS2013, we’ve started hitting an issue where Nuget won’t restore packages. We get error messages similar to this:

Error 21 Could not find a part of the path 'C:\Dev\YourProject\ \packages\Microsoft.AspNet.WebApi.Core.5.2.3'.

I’ve found out that there is a change to the way Nuget picks up files. To get it to work you need to edit the file NuGet.targets changing the line:

<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>

To:

<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(SolutionDir)\</RestoreCommand>

This sorts the issue.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

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

Google photo

You are commenting using your Google 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 )

Connecting to %s