Skip to content

ProjectInstance should allow a way to specify Interactive #8523

Closed

Description

NuGet's static graph-based restore is using the ProjectInstance.FromFile() method to create an instance of a ProjectInstance. However, there is no way to specify the Interactive flag in any public constructor. internal and private constructors derive this flag from the BuildParameters but there is no public constructor that accepts a BuildParameters object either.

https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Build.Tasks.Console/MSBuildStaticGraphRestore.cs#L929

This leads to static graph-restore not being able to set the Interactive flag so then restores can fail in certain cases when the configured credential provider needs to prompt the user for authentication.

I think the ProjectOptions class should just have a Interactive property which gets plumbed through.

Repro steps:

  • Have a set of projects that reference NuGet-based MSBuild project SDKs and package references
  • Configure a feed that requires authentication (like Azure DevOps Artifacts)
  • Configure a credential provider that will get an authentication token via a prompt (like the Azure Artifacts Credential Provider)
  • Enable static graph-based restores via /p:RestoreUseStaticGraphEvaluation=true
  • Restore

This has been a problem for a few years but only recently did I have enough time to figure out why.

/cc @dfederm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions