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

[BuildCheck Suggestion]: Detect use of Exec task to run "dotnet build" or similar commands #11125

Open
dsplaisted opened this issue Dec 11, 2024 · 0 comments
Labels
Area: BuildCheck backlog BuildCheck Suggestion Suggestion for a built in MSBuild analyzer. Label should be applied together with 'Area: BuildCheck' help wanted Issues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim. internal-team-onboarding triaged

Comments

@dsplaisted
Copy link
Member

Summary

We should warn when an Exec task is used to spawn a new build via dotnet build, dotnet publish, etc.

Background and Motivation

It's usually a bad pattern to run dotnet build, dotnet publish, etc from an Exec task, since this spawns an entirely separate build that the MSBuild engine doesn't have visibility over. We should recommend using an MSBuild task instead.

Sample issue or antipattern that the check should be flagging

  <Target Name="BuildVer2022">
    <Exec Command="dotnet build -p:C3DVersion=Ver2022 -c $(Configuration)"/>
  </Target>

Source: dotnet/sdk#45034 (comment)

Sample output

No response

@dsplaisted dsplaisted added Area: BuildCheck BuildCheck Suggestion Suggestion for a built in MSBuild analyzer. Label should be applied together with 'Area: BuildCheck' labels Dec 11, 2024
@surayya-MS surayya-MS added help wanted Issues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim. backlog internal-team-onboarding triaged labels Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: BuildCheck backlog BuildCheck Suggestion Suggestion for a built in MSBuild analyzer. Label should be applied together with 'Area: BuildCheck' help wanted Issues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim. internal-team-onboarding triaged
Projects
None yet
Development

No branches or pull requests

2 participants