简体   繁体   中英

Nuget package error in Visual Studio 2017

I'm getting an error in Visual studio 2017 when I build the solution.

"The package ComponentAce.Compression.Libs.zlib with version 1.0.4 could not be found in C:\Users\.nuget\packages. Run a NuGet package restore to download the package.".

My code is in .net 4.7.2 (C#,WPF)

I tried to install/uninstall/rebuild/clean and I also completely removed any references to that package in my code. Nothing's working. Any idea what's the issue here?

Enable 'Allow Nuget to download missing packages' under Tools -> Options

在此处输入图像描述

See Trouble-shooting nuget issues .

  1. You can clean the cache by VS IDE (Go Tools => Options => Nuget Package Manager => Settings => Clear Nuget caches). After that, clean and build current project again.

  2. If the issue persists, open your Solution directory => close VS instance => delete the.vs folder, and delete the bin and obj folders in Project directory. Then rebuild the project.

  3. If all above not helps, it could be one similar issue here , update VS2017 to latest 15.9.16 to fix it.

Update :

could not be found in C:\Users.nuget\packages

1.What does the specific path looks like? It should be C:\user\user-name\.nuget\packages by default , if the error you got is C:\Users\.nuget\packages , I think you may have a custom nuget.config file which causes this issue.

2.Also, you may create a new empty project and installing the missing packages in that project. Than closed the empty project, reopened the original one to run a rebuild. Hint from marco6 .

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