Samayas MSBuild Nuspec Package Reference Updater.
$ dotnet add package Samayas.MSBuild.NuspecPackageReferenceUpdater
Samayas MSBuild Nuspec Package Reference UpdaterThis package provides an MSBuild component for .NET Core projects that automatically keeps your .nuspec file dependencies in sync with your projects current PackageReference entries.
Instead of manually copying dependencies from your .csproj files into your .nuspec file, this tool handles it for you. Whenever you add or update a PackageReference in your .NET Core project, the MSBuild task will automatically update the corresponding dependencies in your .nuspec file.
Note: This tool is for .NET Core projects only.
Here you can find a video describing how to use this MS Build Nuspec Package Reference Updater https://l.samayas.eu/3OUfu6S4lo
This Nuget build package allows you to update a nuspec file and add or update all existing package references of one or more csproj files;
The following Property group needs to be added to your csproj file that must execute the action and to which you have added the nuget package
<PropertyGroup>
<!-- Path to the nuspec file to be updated -->
<NuspecUpdaterTask_NuspecFilePath>$(MSBuildProjectDirectory)\..\Nuget\file.nuspec</NuspecUpdaterTask_NuspecFilePath>
<!-- List of .csproj files whose PackageReferences will be extracted -->
<NuspecUpdaterTask_ProjectFiles>
$(MSBuildProjectDirectory)\project1.csproj;
$(MSBuildProjectDirectory)\..\project2\project2.csproj
</NuspecUpdaterTask_ProjectFiles>
<!-- Set to true to enable the update task -->
<NuspecUpdaterTask_RunCondition>true</NuspecUpdaterTask_RunCondition>
<!-- Set to true to enable verbose error logging (optional) -->
<NuspecUpdaterTask_PublishErrorLogging>false</NuspecUpdaterTask_PublishErrorLogging>
</PropertyGroup>
The update occurs after the build process.
This is the location of the nuspec file.
A list of 1 or more project files to process to be processed
Whether or not to enable or disable the msbuild task.
Should an unhandled exception occur then when this parameter is set to true, an exception will be logged to an error server.