-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Show warning when referencing an Item as a Property or viceversa #348
Comments
This would potentially save a lot of grief. We may be able to learn from Perl, which has vaguely similar behavior between scalar and array values. |
For what it's worth, MSBuild already has a related feature, to warn when an uninitialized property is used. (Can be enabled through setting MSBUILDWARNONUNINITIALIZEDPROPERTY=1 or BuildParameters.WarnOnUninitializedProperty = true) However, when we introduced this feature back in (IIRC) VS 2010, we quickly discovered that all existing targets files used that pattern so frequently (usually when setting up defaults for commonly known properties) that it was, essentially, useless. So I'd suggest that this also only be available under a flag, at least at first -- I wouldn't be surprised if the existing targets also used this pattern intentionally at times. |
@sarajoiner: Couldn't used-uninitialized tracking in MSBUILDWARNONUNINITIALIZEDPROPERTY easily be amended to ignore the use of a property in the |
…0227.2 (dotnet#348) - Microsoft.Dotnet.Toolset.Internal - 3.1.200-preview.20127.2 Dependency coherency updates - Microsoft.Net.Compilers - 3.5.0-beta4-20128-01 (parent: Microsoft.Dotnet.Toolset.Internal)
This is a good idea for #1777 |
If you have an item
foo
but you forget it's an item and you reference it as a property ($(foo)
), then MSBuild will just evaluate it to an empty string. This adds to the time it takes to debug the build.To make debugging easier, MSBuild should emit a warning: "You are referencing the item foo as a property".
The text was updated successfully, but these errors were encountered: