CZEMacLeod / MSBuild.SDK.SystemWeb

This MSBuild SDK is designed to allow for the easy creation and use of SDK (shortform) projects targeting ASP.NET 4.x using System.Web.
MIT License
151 stars 8 forks source link

GenerateBindingRedirects task emits warning without code - unable to suppress #69

Open Yozer opened 9 months ago

Yozer commented 9 months ago

I'm using /warnaserror msbuild switch to enable warnings as errors. Currently, the messages about the bindings are warnings and the switch turns them into red error.

<Warning Condition="'$(GeneratedBindingRedirectsAction)' == 'Overwrite'"
             File="Web.config"
             Text="Generated Binding Redirects have been applied automatically to the Web.config. This warning will disappear on the next build." />

Proposals:

  1. Replace them with Messages
  2. Add custom Code to Warnings so people can suppress them.

Messages with high importance would be a better joice but let me know. I'm happy to send a PR with either change.

CZEMacLeod commented 9 months ago

@Yozer I don't think messages can include a file reference for 1 thing, and it is a warning - that the source was modified by the build process and that you may need to execute the build again for a 'clean' compile. I certainly agree that adding a code to the warning would not be a bad thing to do, to allow sorting and, in your case, supressing the error.

If you are doing a PR, please take into account the open PR #61 which will move the warnings etc.

If you base your change off that PR, I will pull them both in on the next release.

Yozer commented 9 months ago

@CZEMacLeod thanks for the response. Having code on the warning would also work. It's just adding one line to the Warning task: Code="WHAT123" I'm not sure what prefix would be best there. Same code for all the warnings?

CZEMacLeod commented 9 months ago

@Yozer I think each warning should be different. Indeed, the whole project should ensure we have messages, but that might have to be a separate issue/pr. I think the code prefix should be SWSDK (for System.Web SDK) but if you have a better/different idea, I'm open to suggestions. For these can we go with 100-10x for the codes. (I think there are 3 messages in the binding redirects section). It might be useful to add the information to the docs to make it easier to search for the code too.