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

Detect and warn when users consume OutputPath in Project files directly #41852

Open
baronfel opened this issue Jun 28, 2024 · 0 comments
Open
Labels
Area-NetSDK msbuild-analyzer-candidate Items that would be a good MSBuild Analyzer untriaged Request triage from a team member

Comments

@baronfel
Copy link
Member

Is your feature request related to a problem? Please describe.

There are many properties that are set by the SDK by default, but the SDK defers computing them until .targets files are evaluated to give users a chance to set these properties in .props and project files.

However, users also often read these properties directly in props/project files, leading to scenarios where a property defined in a project file has an incorrect value after the rest of the SDK targets have run. A common property used in this way is OutputPath.

It's common to want to compute a path for some output that will live in the OutputPath of the project, but that final path isn't known until the SDK's DefaultOutputPath targets run. This means the best way for a user to set properties that use OutputPath is to create a Target, tie that Target into the build, and then define their property just before usage.

We should detect the direct usage of properties in project files that are only set later in the SDK and warn users that the values may not be usable or trustworthy.

@baronfel baronfel added the msbuild-analyzer-candidate Items that would be a good MSBuild Analyzer label Jun 28, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NetSDK untriaged Request triage from a team member labels Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NetSDK msbuild-analyzer-candidate Items that would be a good MSBuild Analyzer untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

1 participant