You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran across a bug where I unintentionally defined a property with the same name as another property defined in a target file I included. It would be nice if msbuild had facilities to help detect this type of issue. For instance, if I could have somehow marked my property immutable then msbuild could have issued an error when the property was subsequently overwritten in the imported target file.
One possible way to mark properties as immutable would be via an IsReadOnly attribute applied to property and propertyGroup elements. Also, it would also be nice to be able to change the default to readonly via, possibly, a ReadOnlyProperties attribute applied on the Project element.
There is already a mechanism by which command line properties are treated as immutable. Maybe that same logic could be used to enforce a new readonly property feature. That logic would have to be extended to issue an error instead of silently failing after attempting to update the property as is currently the case for command line properties. I'd like to see an error in that case as well. Possibly enabled via an environment variable ala MSBuildWarnOnUninitializedProperty but MSBuildWarnOnWriteToCommandLineProperty.
Warm regards,
Chris
The text was updated successfully, but these errors were encountered:
I accidentally duplicated this as #1673, and it appears to have gotten a bit more commentary so I'm going to unify by moving this comment to that thread. Great idea, though!
I ran across a bug where I unintentionally defined a property with the same name as another property defined in a target file I included. It would be nice if msbuild had facilities to help detect this type of issue. For instance, if I could have somehow marked my property immutable then msbuild could have issued an error when the property was subsequently overwritten in the imported target file.
One possible way to mark properties as immutable would be via an
IsReadOnly
attribute applied toproperty
andpropertyGroup
elements. Also, it would also be nice to be able to change the default to readonly via, possibly, aReadOnlyProperties
attribute applied on theProject
element.There is already a mechanism by which command line properties are treated as immutable. Maybe that same logic could be used to enforce a new readonly property feature. That logic would have to be extended to issue an error instead of silently failing after attempting to update the property as is currently the case for command line properties. I'd like to see an error in that case as well. Possibly enabled via an environment variable ala
MSBuildWarnOnUninitializedProperty
butMSBuildWarnOnWriteToCommandLineProperty
.Warm regards,
Chris
The text was updated successfully, but these errors were encountered: