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] 'obj\Release\monoandroid81\Resource.Designer.cs' could not be found #181

Closed
RLittlesII opened this issue Aug 20, 2019 · 14 comments
Labels

Comments

@RLittlesII
Copy link

RLittlesII commented Aug 20, 2019

The following Splat Build fails with MsBuild.Sdk.Extras v2.0.41

I explicitly put in the work around detailed #174 (comment) last week to get the builds back green. reactiveui/splat#390

As you can see from the above output on the latest build, when I remove the work around with MsBuild.Sdk.Extras 2.0.41 here, I still received the error.

Related to #174

@clairernovotny
Copy link
Collaborator

Is this about DesignTime or about the ResGen file?

I haven't been able to repro locally but made changes based on reading the targets:

https://github.com/onovotny/MSBuildSdkExtras/blob/master/Source/MSBuild.Sdk.Extras/Build/Platforms/Xamarin/Xamarin.Android.targets#L12-L14

We're not even setting the ResGen file anymore, nor are we setting the private _SdkSetAndroidResgenFile anymore either.

@RLittlesII
Copy link
Author

This is about the ResGen. I thought that was fixed in 2.0.41, but taking out the work around still generates the error.

@RLittlesII
Copy link
Author

I've got another build issue blocking me from reproducing this locally. When I can I will provide more information.

@RLittlesII
Copy link
Author

Attached: binlog.zip

This is from a local build where I was able to reproduce the same issue on that same commit.

@TSIoT
Copy link

TSIoT commented Aug 21, 2019

@RLittlesII Same issue as yours when I use VS2019. But it work fine on VS2017, so I change IDE to let my work could keep going.

@clairernovotny
Copy link
Collaborator

clairernovotny commented Aug 26, 2019

From that binlog, the best I can tell is that GenerateResourceDesigner from Xamarin.Android.Common.targets isn't writing the output file.

_AndroidResourceDesignerFile is calculated by the targets to be obj\Release\monoandroid81\81\Resource.designer.cs, based on the IntermediateOutputPath:
https://github.com/xamarin/xamarin-android/blob/master/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets#L1215

That value is always set. It's supposed to be the output file here:
https://github.com/xamarin/xamarin-android/blob/master/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets#L1298

That file is then included here: https://github.com/xamarin/xamarin-android/blob/master/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets#L727

@jamesmontemagno any ideas?

@clairernovotny
Copy link
Collaborator

Also cc @jonathanpeppers and @jonpryor for some 👀

@jonathanpeppers
Copy link

This came up here: https://developercommunity.visualstudio.com/content/problem/672764/building-xamarin-multi-targeted-plugin-fails-unabl.html

We found that 16.2 has this regression, but it is already fixed in 16.3 previews.

A workaround is to add this MSBuild property to your project:

<AndroidUseIntermediateDesignerFile>False</AndroidUseIntermediateDesignerFile>

Going forward, we are putting these tests in, so we don't break MSBuild.Sdk.Extras accidentally: dotnet/android#3523

@clairernovotny
Copy link
Collaborator

Thanks @jonathanpeppers for the quick reply!

Is there anything that should be updated/changed/defaulted differently here:

https://github.com/onovotny/MSBuildSdkExtras/blob/master/Source/MSBuild.Sdk.Extras/Build/Platforms/Xamarin/Xamarin.Android.targets

That's what has most of the things that came out of the older style csproj.

@clairernovotny
Copy link
Collaborator

@jonathanpeppers That is only used for MonoAndroid without a version. Do you think 9 is the best default for that? If MonoAndroid8.1/MonoAndroid81, etc is specified, it uses that as the TargetFrameworkVersion.

@jonathanpeppers
Copy link

Ok, if they put MonoAndroid, I guess it's reasonable. A NuGet author may want their package to work against apps with an older TargetFrameworkVersion.

@glennawatson
Copy link
Contributor

ReactiveUI put the AndroidUseIntermediateDesignerFile in our directory.target.props and it solved the build error for us.

@clairernovotny
Copy link
Collaborator

clairernovotny commented Sep 19, 2019

Closing as external as it's been fixed in VS 16.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants