msbuild icon indicating copy to clipboard operation
msbuild copied to clipboard

Add the name of the attribute type into the message when the definition cannot find

Open huulinhnguyen-dev opened this issue 4 months ago • 0 comments

Fixes # Fix the issue https://github.com/dotnet/msbuild/issues/10007 the message just display the name of the metadata that holds the parameter value but not display the name of the attribute type whose definition it did not find

Context

When using the MSBuild with WriteCodeFragment in .csproj file, if the positional constructor parameters, use metadata names that resemble _Parameter1, _Parameter2 and the Attribute cannot found, the message display "Could not infer the type of parameter "1" because the attribute type is unknown. The value will be treated as a string" instead of the name of the parameters"

Changes Made

Add the name of the attribute type into the message when the definitions cannot find

Testing

Build a .csproj file with WriteCodeFragment and using an Attribute cannot found with and the message display look like this Could not infer the type of parameter "_Parameter1" because the attribute type "System.TheAttributeCannotFound" is unknown. The value will be treated as a string.

Notes

huulinhnguyen-dev avatar Jun 13 '25 06:06 huulinhnguyen-dev