简体   繁体   中英

Visual Studio 2015 Nuget Restore Problems for Version 1.0.3 of Newtonsoft.Json.dll

I have a solution which was working with Visual Studio 2015 Community in a machine. That machine was crashed and I can not access the source codes over there any more.

However the source codes were checked into TFS. After I got new machine, I got all latest source codes from TFS.

The issue is that this solution in new machine has a lot of compile errors.

Visual Studio 2015 could restore some of the references. However I have a complain like this - 在此处输入图片说明

Clicking button Restore will have this error -

在此处输入图片说明

I don't think I have used a version of 1.0.3 of Newtonsoft.Json.dll directly. I deleted the package folder and all project bin and obj folders. The recompile still can not fix it.

What can be done to fix this problem?

Have you also delete the NuGet.Config file in the packages folder? If you did it, Visual Studio will try to do the MSBuild package restore instead of Automatic Package Restore.

By default, the NuGet.Config file instructs NuGet to bypass adding package binaries to source control. Automatic Package Restore will honor this as long as you leave this file in place. Note that NuGet.Config only has an effect when using Visual Studio to integrate with Team Foundation Server (TFS).

You should also manually remove references in all your projects to the Nuget.targets file. The following article outlines in more details: https://docs.nuget.org/consume/package-restore/migrating-to-automatic-package-restore

If you still can't fix it, try to use the Command-Line Package Restore

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM