Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Xamarin.Android.Build.Tasks] Microsoft.Resource.Designer Assembly #6427

Merged
merged 18 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Documentation/guides/building-apps/build-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,35 @@ To suppress the default AOT profiles, set the property to `false`.

Added in Xamarin.Android 10.1.

## AndroidUseDesignerAssembly

A bool property which controls if the build system will generate an
`_Microsoft.Android.Resource.Designer.dll` as apposed to a `Resource.Designer.cs` file. The benefits of this are smaller applications and
faster startup time.

The default value is `true` in .NET 8.

This setting is not backward compatible with Classic Xamarin.Android.
As a Nuget Author it is recommended that you ship three versions of
the assembly if you want to maintain backward compatibility.
One for MonoAndroid, one for net6.0-android and
one for net8.0-android. You can do this by using [Xamarin.Legacy.Sdk](https://www.nuget.org/packages/Xamarin.Legacy.Sdk). This is only required if your Nuget Library
project makes use of `AndroidResource` items in the project or via a dependency.

```
<TargetFrameworks>monoandroid90;net6.0-android;net8.0-android</TargetFrameworks>
```

Alternatively turn this setting off until such time as both Classic and
net7.0-android have been deprecated.

.NET 8 Projects which choose to turn this setting off will not be able to
consume references which do use it. If you try to use an assembly
which does have this feature enabled in a project that does not, you will
get a `XA1034` build error.
Comment on lines +1389 to +1392
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last concern I have is this comment. Do we need to ask other teams about this? .NET MAUI team at least?

Any existing libraries from Telerik/DevExpress, will need to be updated to work in .NET 8? (If those are mostly UI, they would likely use a value from Resource.designer.cs)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

old style Assemblies will be auto upgraded by the linker during a build. So existing NuGet packages will work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so you only hit an issue if you turn the setting off, got it.


Added in .NET 8. Unsupported in Classic Xamarin.Android.

## AndroidUseInterpreter

A boolean property that causes the `.apk` to contain the mono
Expand Down
16 changes: 16 additions & 0 deletions Documentation/guides/messages/xa1034.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Xamarin.Android error XA1034
description: XA1034 error code
ms.date: 13/12/2022
---
# Xamarin.Android error XA1034

## Example messages

```
Your project references 'Foo.dll' which uses the `_Microsoft.Android.Resource.Designer` assembly, but you do not have this feature enabled. Please set the `AndroidUseDesignerAssembly` MSBuild property to `true` in your project file.
```

## Solution

Edit your csproj directly and change the 'AndroidUseDesignerAssembly' to `True`.
1 change: 1 addition & 0 deletions build-tools/installers/create-installers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.CSharp.targets" ExcludeFromAndroidNETSdk="true" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.D8.targets" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Designer.targets" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Resource.Designer.targets" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.DesignTime.targets" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.EmbeddedResource.targets" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.FSharp.targets" ExcludeFromAndroidNETSdk="true" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.IO;

namespace Xamarin.Android.Prepare
{
[TPN]
class StrongNameSigner_TPN : ThirdPartyNotice
{
static readonly Uri url = new Uri ("https://github.com/brutaldev/StrongNameSigner/");

public override string LicenseFile => string.Empty;
public override string Name => "brutaldev/StrongNameSigner";
public override Uri SourceUrl => url;
public override string LicenseText => @"
Copyright (c) Werner van Deventer (werner@brutaldev.com). All rights reserved.

Licensed under the Apache License, Version 2.0 (the 'License'); you
may not use this file except in compliance with the License. You may
obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an 'AS IS' BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing permissions
and limitations under the License.
";

public override bool Include (bool includeExternalDeps, bool includeBuildDeps) => includeExternalDeps;
}
}
Loading