RoslynCodeTaskFactory
RoslynCodeTaskFactory copied to clipboard
Attribute lookups should be case sensitive to reflect case sensitivity of XML
https://github.com/jeffkl/RoslynCodeTaskFactory/blob/afbc509790b2cc8d76cae6bf697262512bdb8b2d/src/RoslynCodeTaskFactory/CodeTaskFactory.cs#L358-L360
I see that there are case insensitive comparisons for attribute names. It would be better to require exact case matches and throw an error for incorrect case.
The equivalent code in CodeTaskFactory.cs
does a case sensitive match:
https://github.com/Microsoft/msbuild/blob/216f7cd5daf8d848d1a3773cf1290ebf32be8806/src/Tasks/CodeTaskFactory.cs#L237
I'm not sure if I did that deliberately. I wonder if I changed it now it would break anyone? Do you feel pretty strongly about changing it?
I think it should be changed.
I think that with the project as it is, users are able to switch back and forth between using this project and the old MSBuild style of code generation as long as they use only the parts of functionality which overlap (e.g., not #33). Allowing differently cased attributes could result in people accidentally and unintentionally making their project incompatible with the old MSBuild.
Also, I think people editing MSBuild project files expect there to be strict case sensitivity there because it is XML and that is how MSBuild core elements work. For example, if I write <ItemGroup><Compile include="MyFile.cs"/></ItemGroup>
, the project will not load into VS because an item element must have one of the following elements: Include
, Remove
, and Update
.