xamarin-android/build-tools/create-packs
Dean Ellis b3079db44e
Add `DiagnosticSuppressor` to suppress the IDE0002 Style Hint in the IDE (#9310)
Context: https://github.com/dotnet/android/issues/8381

Add a `DiagnosticSuppressor` to "turn off" the `IDE0002` style
diagnostic message which incorrectly tells users to use the
`_Microsoft.Android.Resource.Designer.ResourceConstant` type directly.
This can cause allot of annoyance with our users because it appears on
EVERY single usage of `Resource.*`. So you end up with what looks like
code spagetti. 

So we need to start shipping an `Analyzer` assembly along with the
`Ref` framework pack. This is the place these things need to go.
Unfortunately it means that the older frameworks will not get this
analyzer. Only the current one. 

On the packaging side, the Analyzer assembly has to go in a
`analyzers/dotnet/<language>` folder in the .Ref Nuget Package. There
also needs to be an entry in the `FrameworkList.xml` file which has a
`Type="Analyzer" ` and a `Language="cs"`. This allows the IDE's to
pickup the code. We can ship both regular Analyzers and the
DiagnosticSuppressors in the same assembly. So we can extend this with
more if needed.

How this works is we use Rosyln to look for the IDE0002 diagnsotic
message, we then check the code and see if it is refering to a
`_Microsoft.Android.Resource.Designer.*` derived class. If it is , we
add a suppression. This will stop the hint appearing in the IDE. I
have tested this on VS in devbox and it appears to work . 

Also we generate a Resource Designer assembly and an Intermediate
source file at build time. Both of these contain classes which should
have the `GeneratedCode` Attribute. So lets add it. The version will
be the same as the build assembly used to generate it.
2024-09-30 16:09:12 -05:00
..
ConfigureLocalWorkload.targets Add `DiagnosticSuppressor` to suppress the IDE0002 Style Hint in the IDE (#9310) 2024-09-30 16:09:12 -05:00
Directory.Build.props [build] Update package metadata (#9230) 2024-08-20 14:25:27 -04:00
Directory.Build.targets Add `DiagnosticSuppressor` to suppress the IDE0002 Style Hint in the IDE (#9310) 2024-09-30 16:09:12 -05:00
Icon.png [build] Update package metadata (#9230) 2024-08-20 14:25:27 -04:00
License.targets [build] Update package metadata (#9230) 2024-08-20 14:25:27 -04:00
Microsoft.Android.Ref.proj Add `DiagnosticSuppressor` to suppress the IDE0002 Style Hint in the IDE (#9310) 2024-09-30 16:09:12 -05:00
Microsoft.Android.Runtime.proj [native] Real shared libraries in APK `/lib` directories (#9154) 2024-09-24 10:38:38 -04:00
Microsoft.Android.Sdk.proj [build] Remove classic components from .NET packages (#8464) 2023-10-30 14:51:18 -04:00
Microsoft.NET.Sdk.Android.proj Bump to dotnet/installer/main@42ace91ba7 .NET 9.0.100-alpha.1.23603.1 (#8366) 2023-12-04 15:32:03 -05:00
SignList.xml [native] Real shared libraries in APK `/lib` directories (#9154) 2024-09-24 10:38:38 -04:00
SignVerifyIgnore.txt [bundletool] Remove com/sun/jna content (#9162) 2024-08-12 14:07:47 -04:00
linux-README.md [ci] Sign and publish Microsoft.Android.Sdk.Linux (#6613) 2022-01-12 20:17:18 -05:00
vs-workload.in.props [vs-workload] Set EnableSideBySideManifests=true (#8179) 2023-07-24 15:50:22 -04:00