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

DesignTime Builds should honour AndroidGenerateResourceDesigner. #6844

Merged
merged 4 commits into from Mar 25, 2022

Conversation

dellis1972
Copy link
Contributor

@dellis1972 dellis1972 commented Mar 21, 2022

Fixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1440274

The design time build was not taking into account the AndroidGenerateResourceDesigner property value.
As a result we would always get a Resource.designer.cs file generated in the designtime directory.

So lets turn off the designtime build if that property is set.
Also note set a defaut for AndroidGenerateResourceDesigner in legacy so that it is always true.
This is to get around some issues under legacy where AndroidGenerateResourceDesigner was not
defined. This is because the designtime build tasks and targets are shared between both systems.

@dellis1972 dellis1972 marked this pull request as ready for review March 23, 2022 14:15
@jonpryor
Copy link
Member

Fixes: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1440274

In some circumstances, when
[`$(AndroidGenerateResourceDesigner)`][0]=False and a custom
`Resource.Designer.cs` is provided in the project, loading a project
would cause Visual Studio IntelliSense to show an ambiguity with e.g.
`Resource.Layout.activity_main`, as the member exists in *both* the
custom `Resource.Designer.cs` *and* in the design-time-generated
`Resource.Designer.cs`.

This was because the design-time build was not taking
`$(AndroidGenerateResourceDesigner)` into consideration before
generating `Resource.designer.cs`.  Consequently, we would *always*
create a `Resource.designer.cs` file into the `designtime` directory.

Fix this by turning off the `designtime` build when
`$(AndroidGenerateResourceDesigner)`=False.

Additionally, update `Xamarin.Android.Legacy.targets` so that
`$(AndroidGenerateResourceDesigner)` is *always* set in Legacy builds,
with a default value of True.  This is to get around some issues under
legacy where `$(AndroidGenerateResourceDesigner)` was not defined.
This is because the `designtime` build tasks and targets are shared
between both Classic and .NET 6 build systems.

[0]: https://github.com/xamarin/xamarin-android/blob/4b33a6229c9babde795dea48d20ca86d8f9f9c97/Documentation/guides/building-apps/build-properties.md#androidgenerateresourcedesigner

@jonpryor jonpryor merged commit 8407027 into xamarin:main Mar 25, 2022
@dellis1972 dellis1972 deleted the WI1440274 branch November 30, 2022 16:04
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants