This content is part of a third party extension that is not supported by the Cake project.
For more information about this extension see Cake.Incubator.
Summary
Gets a project package reference
- Assembly
- Cake
.Incubator .dll - Namespace
- Cake
.Incubator .Project - Containing Type
- Project
Parser Extensions
Syntax
public static PackageReference GetPackage(this CustomProjectParserResult projectParserResult, string packageName, string targetFramework = null)
Examples
Get the NUnit package reference
CustomParseProjectResult project
= ParseProject(new FilePath("test.csproj"), configuration: "Release", platform: "x86");
PackageReference ref = project.GetReference("NUnit");
string nUnitVersion = ref.Version;
PackageReference ref = project.GetReference("NUnit", "netstandard2.0");
string nUnitVersion = ref.Version;
Parameters
Name | Type | Description |
---|---|---|
projectParserResult | Custom |
the parsed project |
packageName | string | the package name |
targetFramework | string | the specific targetframework, if not specified, returns the package for any TargetFramework |
Return Value
Type | Description |
---|---|
PackageReference | The package reference if found |