I get a compiler warning on my ASP.Net Core (2.1) project:
This warning is given by the CodeAnalysis analyzer (I use version 1.1.0-beta008).
I have already added an "AssemblyInfo.cs" file to that same project containing this single line of code:
[assembly: System.CLSCompliant(false)]
However, I see that there are TWO dlls generated for this project: the expected {projectname}.dll
but also {projectname}.Views.dll
.
Using ILSpy I can confirm that the attribute is applied to the {projectname}.dll, but it is not applied to the {projectname}.Views.dll - which undoubtedly causes this warning.
Adding that same AssemblyInfo.cs to the Views folder causes an error: CS0579 Duplicate 'System.CLSCompliant' attribute. So apparently that Views dll does not contain "everything in the Views folder" but only the compiled cshtml files.
Adding that attribute to (for instance) the _ViewStart.cshtml does not lead to a legal syntax.
So how can I apply this attribute specifically to the views?
Note that I can remove the warning by lowering the severity of the CA1014 rule (Dependencies > Analyzers > Microsoft.CodeQuality.Analyzers), but I would rather "solve" this than "hide" it.