32822e8f0a | ||
---|---|---|
.github | ||
.nuke | ||
build | ||
demo | ||
images | ||
src | ||
tests/PackageReferenceEditor.UnitTests | ||
.editorconfig | ||
.gitattributes | ||
.gitignore | ||
LICENSE.TXT | ||
NuGet.Config | ||
PackageReferenceEditor.sln | ||
README.md | ||
_config.yml | ||
azure-pipelines.yml | ||
build.cmd | ||
build.ps1 | ||
build.sh | ||
global.json |
README.md
PackageReferenceEditor
MSBuild, csproj and props package reference editor.
Screenshots
NuGet
PackageReferenceEditor is delivered as a NuGet package.
You can find the packages here NuGet and install the package like this:
Install-Package PackageReferenceEditor
Package Sources
- https://api.nuget.org/v3/index.json
- https://pkgs.dev.azure.com/wieslawsoltes/GitHub/_packaging/Nightly/nuget/v3/index.json
Example Usage with Cake build scripts
Same code can be used in C# programs by removing #addin
directive and installing package from NuGet.
Print package versions
#addin "nuget:?package=PackageReferenceEditor"
using PackageReferenceEditor;
Updater.FindReferences("./build", "*.props", new string[] { }).PrintVersions();
Updater.FindReferences("./", "*.csproj", new string[] { }).PrintVersions();
Validate package versions
#addin "nuget:?package=PackageReferenceEditor"
using PackageReferenceEditor;
Updater.FindReferences("./build", "*.props", new string[] { }).ValidateVersions();
Updater.FindReferences("./", "*.csproj", new string[] { }).ValidateVersions();
Update package version
#addin "nuget:?package=PackageReferenceEditor"
using PackageReferenceEditor;
Updater.FindReferences("./build", "*.props", new string[] { }).UpdateVersions("Newtonsoft.Json", "10.0.3");
Get installed package versions
#addin "nuget:?package=PackageReferenceEditor"
using PackageReferenceEditor;
var result = Updater.FindReferences("./build", "*.props", new string[] { });
result.ValidateVersions();
var version = result.GroupedReferences["Newtonsoft.Json"].FirstOrDefault().Version;
Information("Newtonsoft.Json package version: {0}", version);
Get available package versions
#addin "nuget:?package=PackageReferenceEditor"
using PackageReferenceEditor;
using System.Linq;
var versions = NuGetApi.GetPackageVersions("https://api.nuget.org/v3/index.json", "Newtonsoft.Json").Result;
var latestVersion = versions.Reverse().FirstOrDefault();
Information("Newtonsoft.Json package latest version: {0}", latestVersion);
Resources
License
PackageReferenceEditor is licensed under the MIT license.