DEV Community

Cover image for .NET MAUI: Update NuGet Packages using Visual Studio Code
Victor Hugo Garcia
Victor Hugo Garcia

Posted on

.NET MAUI: Update NuGet Packages using Visual Studio Code

In this post, I will show you how to use Visual Studio Code in macOS, a popular and lightweight code editor, to search for your outdated NuGet packages of your project with ease and update those faster using the terminal and updating a couple of bits on your .csproj file.


It is required for you to install the official .NET MAUI extension in Visual Studio Code and the dotnet-outdated tool.

How to get a list of updated packages

  1. Open your .NET MAUI app folder on Visual Studio Code. The .NET MAUI extension will automatically load your solution with the referenced projects.
  2. Once Visual Studio Code loaded your project's solution successfully on the Solution Explorer.
  3. Open the Visual Studio Code integrated terminal and run the following command: dotnet outdated
  4. The previous command will parse and show you a list of NuGet packages where an updated version exists based on your current project installed packages (see image below for further details).

Image description

On the image above, it lists not only a specific project but any other project in the solution, and broken down into platforms, so it is easy to identify which NuGet packages being used on your project offer a new updated version.

Version color legend:
<red>   : Major version update or pre-release version. Possible breaking changes.
<yellow>: Minor version update. Backwards-compatible features added.
<green> : Patch version update. Backwards-compatible bug fixes.
Enter fullscreen mode Exit fullscreen mode

How to update your project's NuGet packages

It is super easy, just open your .csproj file and find the Package References, for example:

      <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.6" />
      <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.6" />
Enter fullscreen mode Exit fullscreen mode

Then update the key-value from Version and set the new version retrieved previously by using the command on the terminal.

Finally, once all your NuGet package references are updated as your requirements, I recommend you to close Visual Studio Code and re-open it, so the extension reloads again the solution and projects. As a verification method to make sure your packages are up to date, run the command dotnet outdated again, so you get an updated list.

That's it!


In Visual Studio Code, I have tried some NuGet Managament extensions without luck, due to the nature of .NET MAUI being cross-platform, the current existing extensions do not support it, that is the main reason of me writing this article.
I heard somewhere that the Microsoft team is working on extension/feature that will make the NuGet Management easily on projects using Visual Studio Code, so hopefully we can see a preview in the coming months.

Updating NuGet packages is important to keep our projects up to date with the latest features and bug/security fixes.

Thank you for reading!

Follow me on Social:

Top comments (0)