C
C#2y ago
sparr

VSCode extension can't find nuget packages

I restored a missing nuget package using msbuild and now I can use msbuild to compile my project without errors. However, the language server can't seem to find it so I get The type or namespace name 'whatever' could not be found (are you missing a using directive or an assembly reference?) as a Problem everywhere any part of that package is used. How can I tell the language server where nuget put the dll? (and how can I find that, in the first place?)
4 Replies
Angius
Angius2y ago
Welcome to the VS Code experience Also, any reason you used msbuild directly, and not the dotnet commands?
atakancracker
atakancracker2y ago
Here you can find nuget cache and what is inside, try to run nuget locals all -clear visual studio and maybe vs code have some inner cache that doesn't update intellisense immediately (this conclusion is based on just my user experience, I had same issue and I was clearing nuget cache, not found errors disappears, I assume you are using correct using statements and assembly/namespace is exist in nuget path)
atakancracker
atakancracker2y ago
dotnet clean my.sln dotnet nuget locals all --clear dotnet build my.sln
sparr
sparr2y ago
Every time I've used the dotnet commands I ran into problems that lead to people on irc and discord telling me to switch to msbuild. Thanks, it seems to have been a cache problem.