Fix .nuspec Dependency Updates in Multi-Project .NET Solutions | NuGet and MSBuild

Published 14/08/2025

Description

Fix .nuspec dependency updates in multi-project .NET solutions by syncing package references from your .csproj files and automating the process with MSBuild. In this video, I walk through a practical approach for keeping a standalone .nuspec file aligned with the dependencies declared across multiple .NET projects, then turn that workflow into a reusable MSBuild step for packaging automation. 0:00 - Introduction 0:13 - Description 3:44 - .NET Core NuGet Packages 6:23 - Combined NuGet 8:46 - Merge CSProj to Nuspec App 10:34 - Test the App 12:09 - Done? 12:32 - MSBuild 17:23 - Conclusion I start by showing how standard .NET packaging normally works at the project level, then move to a standalone .nuspec approach for scenarios where you want tighter control over a combined package. NuGet’s documentation explains that .nuspec is the package manifest, while PackageReference metadata is typically defined in project files and modern pack flows can run through MSBuild. I then build a small utility that reads dependency information from .csproj files, updates the .nuspec, and finally integrates that logic into the build pipeline as an MSBuild-based step. Microsoft’s NuGet guidance also notes that for PackageReference projects, packaging is expected to work through MSBuild pack targets rather than older nuget.exe pack workflows. This video is useful if you maintain internal libraries, publish NuGet packages from multi-project solutions, or want to avoid dependency drift between project files and a manually maintained .nuspec. #NuGet #MSBuild #DotNet Sample Code Nuspec Updater: https://l.samayas.eu/hnkDwFBH7X?P=YT&V=18 Samayas.MSBuild.NuspecPacakgeReferenceUpdater: https://l.samayas.eu/jlvKxt5via?P=YT&V18 Follow me on X: https://l.samayas.eu/jo3eaYEf3E?P=YT&V=18 Buy me a Coffee: https://l.samayas.eu/jX6xL7EWhd?P=YT&V=18 Studio Equipment Camera Sony Alpha ZV-E10 II: https://l.samayas.eu/k7y90TREl0?P=YT&V=18 Secondary Camera Obsbot Tail Air: https://l.samayas.eu/iFQu9W