Table of Contents

Class DetectConsumingPackageReferenceTask

Namespace
Steeltoe.Management.GitProperties.Build
Assembly
Steeltoe.Management.GitProperties.Build.dll

Determines whether this project's own fully-resolved dependency graph includes any of PackageIds. Used to auto-detect whether to generate git.properties, so most projects in a large solution skip generation without opting out individually.

public sealed class DetectConsumingPackageReferenceTask : Task, ITask
Inheritance
DetectConsumingPackageReferenceTask
Implements
Inherited Members

Remarks

Reads ProjectAssetsFile (project.assets.json) rather than this project's own @(PackageReference) items: NuGet flattens the entire transitive graph, through both PackageReference and ProjectReference chains, into every consuming project's assets file, so this also detects a shared library wrapping actuator registration on behalf of many host apps. The assets file is written by a prior, separate restore pass, so if it doesn't exist yet (a fresh clone with no restore), this safely reports no match instead of failing the build.

Properties

HasReference

Gets or sets a value indicating whether any of PackageIds was found.

[Output]
public bool HasReference { get; set; }

Property Value

bool

PackageIds

Gets or sets the semicolon-separated list of package IDs to look for.

public string PackageIds { get; set; }

Property Value

string

Remarks

Deliberately not [Required]: MSBuild's required-parameter check treats an empty string the same as "not supplied", which would turn an explicitly blank value into a build error instead of the graceful "no package ID ever matches" outcome ContainsAnyPackage(string) already produces. An explicit blank value does reach this property in one case: a global property set on the command line (e.g. "-p:GitPropertiesConsumingPackageIds=") can never be reassigned by the project's own conditional default, so it stays blank all the way through instead of falling back to the default package ID.

ProjectAssetsFile

Gets or sets the project's resolved assets file (typically $(ProjectAssetsFile)), or empty/nonexistent when the project has never been restored.

public string ProjectAssetsFile { get; set; }

Property Value

string

Methods

Execute()

Must be implemented by derived class.

public override bool Execute()

Returns

bool

true, if successful