使用nopCommerce(.NET Core)遇project.assets.json缺失及NuGet还原异常
Hey there, let's work through this frustrating NuGet issue you're facing with nopCommerce after updating VS2017 to 15.5.4. I've helped a few folks troubleshoot similar problems post-VS updates, so here are some actionable steps to get your project back on track:
Delete obj and bin folders manually
VS updates can leave corrupted cache files in these directories that interfere with NuGet restore. Close Visual Studio entirely, navigate to each project in your solution, delete theobjandbinfolders, then reopen VS. This often clears up lingering reference issues.Force clear NuGet cache
Sometimes VS holds onto outdated or corrupted package cache. You can do this two ways:- Through VS: Go to
Tools → Options → NuGet Package Manager → General, then click "Clear All NuGet Cache(s)". - Via command line: Open the Package Manager Console and run
dotnet nuget locals all --clear—this is more thorough and often fixes cache-related restore failures.
- Through VS: Go to
Verify NuGet package sources
VS updates can occasionally reset your package source settings. Right-click your solution →Properties → NuGet Package Manager → Package Sourcesand make sure the official NuGet source (https://api.nuget.org/v3/index.json) is enabled and set as a primary source. If any custom sources are causing conflicts, try disabling them temporarily.Run
dotnet restoredirectly from command line
The built-in VS restore might be failing silently. Open Command Prompt, navigate to your solution's root folder, and rundotnet restore. If a specific project is causing issues, target it directly withdotnet restore YourNopCommerceProject.csproj—this gives you more detailed error output if something's wrong with the project's package references.Inspect your .csproj files
In rare cases, VS updates can mess up the package reference entries in your project files. Right-click the problematic project →Edit <ProjectName>.csprojand check that allPackageReferencenodes have valid versions and paths. Compare them to a fresh nopCommerce project's csproj to spot any missing or malformed entries.Repair your Visual Studio installation
If none of the above work, the VS update might have corrupted some NuGet or .NET Core components. Open the Visual Studio Installer, select your 15.5.4 installation, click "Modify", ensure "NuGet Package Manager" and ".NET Core Development Tools" are checked, then click "Modify" to repair the installation.
Start with the first two steps—they're the quickest fixes for most post-update NuGet glitches. If you still run into issues, the command-line restore should give you more clues about what's blocking the process.
内容的提问来源于stack exchange,提问作者NeverTrust

