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
Checks for a project package reference by name and optional TargetFramework
- Assembly
- Cake
.Incubator .dll - Namespace
- Cake
.Incubator .Project - Containing Type
- Project
Parser Extensions
Syntax
public static bool HasPackage(this CustomProjectParserResult projectParserResult, string packageName, string targetFramework = null)
Examples
Checks if the project has an NUnit package
CustomParseProjectResult project
= ParseProject(new FilePath("test.csproj"), configuration: "Release", platform: "x86");
bool ref = project.HasReference("NUnit"); // true
bool ref = project.HasReference("NUnit", "net45"); // false
Parameters
Name | Type | Description |
---|---|---|
projectParserResult | Custom |
the parsed project |
packageName | string | the package name |
targetFramework | string | the target framework, if not specified, checks all TargetFrameworks for the package |
Return Value
Type | Description |
---|---|
bool | True if package exists in project, otherwise false |