DEV Community

David Ortinau
David Ortinau

Posted on

Managing NuGets in VS Code

I do most of my app building on a MacBook with Visual Studio Code, and that means I am learning new ways of doing things in the absence of an IDE.

One of the main things I miss about using an IDE is the NuGet package manager. Actually, I hesitate to say "miss" because I never liked the package manager experiences anyway. I would only use them to see versions, and then I would hand edit my csproj file before doing a dotnet restore or just building.

In most cases I can open NuGet.org to look for the version information of the package in question, but that means changing context from VS Code which bums me out. I asked GitHub Copilot how I could do this in VS Code, and it pointed me to a .NET CLI tool called dotnet-outdated-tool.

To install:



dotnet tool install --global dotnet-outdated-tool 


Enter fullscreen mode Exit fullscreen mode

Running the outdated command from the terminal evals my project/solution and tells me what versions are available. Sweet!



dotnet outdated


Enter fullscreen mode Exit fullscreen mode

image of the terminal output in visual studio code listing all the packages and versions of the project

From there I can update one ore more packages, or return to editing the csproj as I prefer to do. And this tool does more. I can filter on a partial or full package name like Microsoft.

image of the terminal output in visual studio code listing only the packages from the project that include Microsoft in the name

To view all the options, run dotnet outdated --help.

https://github.com/dotnet-outdated/dotnet-outdated

Just dotnet please

You can (of course) do all this with the .NET CLI and not use that tool. It's a bit more typing. Here I filter down to the iOS target framework.



dotnet list package --include-prerelease --framework net8.0-ios17.2 --outdated


Enter fullscreen mode Exit fullscreen mode

image of the terminal output in visual studio code listing NuGet packages by target framework

I do like the visibility this gives me to the sources being used. I can even restrict to a specific source.

See dotnet list package docs for more info.

With these commands I can be productive managing my NuGets in VS Code developing .NET MAUI apps. And as Maddy Montaquila says, working with the command line "makes me feel like a real developer". :)

Top comments (0)