Xamarin.Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
Перейти к файлу
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
.gdn [Mono.Android] Add support for AndroidMessageHandler ClientCertificates (#8961) 2024-07-10 14:21:45 -04:00
.github [ci] Update resourceManagement.yml (#9070) 2024-07-01 16:20:51 -04:00
.vscode It's ".NET for Android", not ".NET Android" (#8933) 2024-05-13 12:01:00 -04:00
Documentation [Xamarin.Android,Build.Tasks] Library .aar has $(AndroidManifest) (#8273) 2024-09-30 07:13:13 -04:00
Localize LEGO: Pull request (#9335) 2024-09-26 08:29:03 -05:00
build-tools Add `DiagnosticSuppressor` to suppress the IDE0002 Style Hint in the IDE (#9310) 2024-09-30 16:09:12 -05:00
eng Add `DiagnosticSuppressor` to suppress the IDE0002 Style Hint in the IDE (#9310) 2024-09-30 16:09:12 -05:00
external Bump to dotnet/java-interop/main@9d997232 (#9330) 2024-09-25 14:36:59 -05:00
samples [Xamarin.Android,Build.Tasks] Library .aar has $(AndroidManifest) (#8273) 2024-09-30 07:13:13 -04:00
src Add `DiagnosticSuppressor` to suppress the IDE0002 Style Hint in the IDE (#9310) 2024-09-30 16:09:12 -05:00
src-ThirdParty Bump to NDK r27 (#9020) 2024-07-19 22:40:28 +00:00
tests [Xamarin.Android.Build.Tasks] Add Inputs for _GenerateJavaStubs (#9319) 2024-09-30 10:21:39 -04:00
tools [native] Real shared libraries in APK `/lib` directories (#9154) 2024-09-24 10:38:38 -04:00
.editorconfig [Xamarin.Android.Build.Tasks] make CA2022 an error (#9282) 2024-09-05 14:08:03 -05:00
.external Bump recommended Android SDK versions for API 35 (#9289) 2024-09-10 09:56:10 -04:00
.gitattributes
.gitignore [ci] Fix test categories for emu smoke tests (#7374) 2022-09-14 20:35:14 -04:00
.gitmodules Bump to dotnet/android-api-docs@c14203771a (#8992) 2024-06-28 15:57:45 -04:00
.lgtm.yml [s360] Ignore irrelevant lz4+Python warnings (#8962) 2024-05-21 13:18:04 -04:00
CODE-OF-CONDUCT.md Link Code of Conduct (#9034) 2024-06-14 14:43:05 -04:00
Configuration.Override.props.in [Mono.Android] Bind and enumify API-35 (#9043) 2024-07-09 15:36:53 -04:00
Configuration.props Add `DiagnosticSuppressor` to suppress the IDE0002 Style Hint in the IDE (#9310) 2024-09-30 16:09:12 -05:00
Directory.Build.props $(AndroidPackVersionSuffix)=rtm; Stable 35.0.x branding (#9337) 2024-09-26 13:52:55 -05:00
Directory.Build.targets Bump external/Java.Interop from `3436a30` to `5bca8ad` (#8803) 2024-03-12 20:17:57 -04:00
LICENSE.TXT [build] Include MIT license in most NuGet packages (#8787) 2024-03-06 09:43:54 -08:00
Makefile [build] Remove make framework-assemblies target (#9269) 2024-09-03 10:12:53 -04:00
NuGet.config [build] add feeds to fix `MAUI Integration` (#9344) 2024-09-30 10:36:01 -05:00
README.md Link Code of Conduct (#9034) 2024-06-14 14:43:05 -04:00
SECURITY.md It's ".NET for Android", not ".NET Android" (#8933) 2024-05-13 12:01:00 -04:00
THIRD-PARTY-NOTICES.TXT Update THIRD-PARTY-NOTICES.txt generation code (#8853) 2024-04-03 19:07:50 +00:00
Xamarin.Android-Tests.sln [ci] Parallelize and reduce overhead of MSBuild test stage. (#7850) 2023-03-10 12:12:46 -06:00
Xamarin.Android.BootstrapTasks.sln
Xamarin.Android.Build.Tasks.sln Add `DiagnosticSuppressor` to suppress the IDE0002 Style Hint in the IDE (#9310) 2024-09-30 16:09:12 -05:00
Xamarin.Android.code-workspace [Xamarin.Android.Build.Tasks] fastdev works with aab files (#8990) 2024-06-12 20:19:28 -04:00
Xamarin.Android.sln Add `DiagnosticSuppressor` to suppress the IDE0002 Style Hint in the IDE (#9310) 2024-09-30 16:09:12 -05:00
before.Xamarin.Android.sln.targets [xabuild] Remove xabuild, unused pipelines (#8720) 2024-02-15 18:36:06 -05:00
build.cmd Remove more xabuild (#8263) 2023-08-14 15:48:43 -04:00
build.sh [build] Update VSCode Support (#5987) 2021-07-08 13:27:40 -04:00
dotnet-local.cmd dotnet-local & net8: local dotnet first in PATH (#8222) 2023-08-12 06:50:58 -04:00
dotnet-local.sh dotnet-local & net8: local dotnet first in PATH (#8222) 2023-08-12 06:50:58 -04:00
global.json [One .NET] Target net6.0 instead of netcoreapp3.1 (#5891) 2021-04-30 09:27:12 -05:00
msfinal.pub
product.snk

README.md

.NET for Android banner

.NET for Android

.NET for Android provides open-source bindings of the Android SDK and tooling for use with .NET managed languages such as C#. This ships as an optional .NET workload for .NET 6+ that can be updated independently from .NET in order to respond to external dependency updates like new Android platform and tooling.

.NET for Android is part of .NET MAUI, and may also be used independently for native Android development using .NET.

Support

.NET for Android is part of .NET MAUI, since it was introduced in May 2022 as part of .NET 6, and is currently supported as described in the .NET MAUI Support Policy.

Support for Xamarin.Android ended on May 1, 2024 as per the Xamarin Support Policy:

Xamarin support ended on May 1, 2024 for all Xamarin SDKs including Xamarin.Forms. Android API 34 and Xcode 15 SDKs (iOS and iPadOS 17, macOS 14) are the final versions Xamarin targets from existing Xamarin SDKs (i.e. no new APIs are planned).

Follow the official upgrade guidance to bring your Xamarin applications to the latest version of .NET.

Downloads

.NET for Android ships as a workload through the dotnet workload system in .NET 6+.

In its simplest form, .NET for Android can be installed by running:

dotnet workload install android

See the .NET workload documentation for additional installation commands and options.

While no longer supported, Classic Xamarin.Android installers are still available here.

Contributing

If you are interested in fixing issues and contributing directly to the code base, please see the following:

Feedback

Discord

License

Copyright (c) .NET Foundation Contributors. All rights reserved. Licensed under the MIT License.