Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[One .NET] add $(AndroidGenerateResourceDesigner) property (#6224)
Fixes: #6198 When migrating Xamarin.Android binding projects to .NET 6, one difference is that `Resource.designer.cs` will be generated by .NET 6 class libraries. This can result in build failures, e.g.: error CS0101: The namespace 'MyBinding' already contains a definition for 'Resource' There is not currently a way to turn this off; if you try: dotnet build -p:AndroidUseIntermediateDesignerFile=false Then `Resources\Resource.designer.cs` will be generated instead. There is no way to prevent this behavior, because `$(AndroidResgenFile)` defaults to this value. To solve cases where you *don't* want `Resource.designer.cs` at all: 1. Remove the `$(AndroidResgenFile)` default value. 2. Add a new `$(AndroidGenerateResourceDesigner)` MSBuild property, that seems like it will be a better name for .NET 6. `$(AndroidGenerateResourceDesigner)` defaults to True. 3. `$(AndroidUseIntermediateDesignerFile)` is based on `$(AndroidGenerateResourceDesigner)`. This way, if a Xamarin.Android binding project is migrated to .NET 6, the binding project can set `$(AndroidGenerateResourceDesigner)`=False to prevent `Resource.designer.cs` from being generated, which may prevent build failures. I added a test and docs for the new property.
- Loading branch information
1 parent
5f408eb
commit 02c3347
Showing
6 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters