Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to check if a target exists in a project without errors #2471

Closed
emgarten opened this issue Aug 24, 2017 · 3 comments
Closed
Labels

Comments

@emgarten
Copy link
Member

Proposal

There should be a way to check if a target exists or not in a project without the user seeing warnings/errors when it does not.

Scenario

NuGet restore walks all project references by using the <MSBuild> element to call a target in child projects. Child projects that do not import common props/targets are missing the restore target display an error to the user. Often it is expected that the target will not exist, for example if the user creates a custom project file and references it.

Since Restore isn't able to gracefully probe projects the user sees a lot of extra noise when the target is missing. Restore also isn't able to tell the difference between a project that doesn't support restore, and one that has invalid XML or other issues.ore from failing when it should.

Possible ways to solve this

  • <MSBuild> could provide an option to skip projects where the target doesn't exist
  • Provide a way to filter a set of projects based on the existence of a target or property
AndyGerlicher added a commit to AndyGerlicher/msbuild that referenced this issue Sep 21, 2017
Add optional SkipMissingTargets property to the MSBuild task. This
allows for the ability to make changes to our project to project
reference protocol which would be an otherwise breaking change.

Related to dotnet#2472

Closes dotnet#2471
AndyGerlicher added a commit to AndyGerlicher/msbuild that referenced this issue Sep 27, 2017
Add optional SkipMissingTargets property to the MSBuild task. This
allows for the ability to make changes to our project to project
reference protocol which would be an otherwise breaking change.

Related to dotnet#2472

Closes dotnet#2471
AndyGerlicher added a commit to AndyGerlicher/msbuild that referenced this issue Sep 27, 2017
Add optional SkipNonexistentTargets property to the MSBuild task. This
allows for the ability to make changes to our project to project
reference protocol which would be an otherwise breaking change.

Related to dotnet#2472

Closes dotnet#2471
@emgarten
Copy link
Member Author

@AndyGerlicher which release of VS/CLI will this be available in?

@AndyGerlicher
Copy link
Contributor

Any 15.5 Preview 2 bits (CLI or VS). Around 15.5.154+ or so.

radical pushed a commit to mono/msbuild that referenced this issue Oct 25, 2017
Add optional SkipNonexistentTargets property to the MSBuild task. This
allows for the ability to make changes to our project to project
reference protocol which would be an otherwise breaking change.

Related to dotnet#2472

Closes dotnet#2471
@mungojam
Copy link

mungojam commented Feb 7, 2018

It seems that this isn't implemented in msbuild /t:restore on VS 15.5, so we are still having to use 'nuget restore' instead. Will it be implemented in msbuild for VS 15.6?

@AR-May AR-May added the triaged label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants