Xamarin-android: Updating to Visual Studio Community 7.5 causes ambiguous resource layouts

Created on 10 May 2018  路  18Comments  路  Source: xamarin/xamarin-android

Steps to Reproduce

  1. upgrade to Visual Studio Community 7.5
  2. now getting an error about ambiguous resource layouts
  3. 3.

Expected Behavior

no layout issues

Actual Behavior

IDE is reporting ambiguous Android resource layouts for all Android layouts

Version Information

7.5

Most helpful comment

The error message is as follows:
"Ambiguity between 'Resource.Id.some_value' and 'Resource.Id.some_value'

Yes, there is a designtime folder in obj/Debug. I have tried doing a "Clean All", then deleting all the files under obj/Debug, then a Build. The designtime folder gets recreated, and the issue still persists.

All 18 comments

Cross-referencing note for the Microsoft team

Although the description provided above does not mention the exact text of the message the user is seeing, I am fairly confident this is a duplicate of: https://developercommunity.visualstudio.com/content/problem/248182/xamarin-resources-indicate-duplicates.html

do you have a designtime folder in the obj/Debug folder? Under Mac that folder should not exist afaik, since VSForMac does not do design time builds. The only way I can see this happening is if the designer is being included twice from different locations.

The error message is as follows:
"Ambiguity between 'Resource.Id.some_value' and 'Resource.Id.some_value'

Yes, there is a designtime folder in obj/Debug. I have tried doing a "Clean All", then deleting all the files under obj/Debug, then a Build. The designtime folder gets recreated, and the issue still persists.

This is also happening to me now. That is, a Resource.Designer.cs file is being generated inside Debug/designtime folder everytime there's a change in my android resources folder.

My workaround however is to delete or comment-out everything inside that particular Resource.Designer.cs file over again. My app successfully compiles after that. However, though it compiles, VS is mistakenly flagging as error any reference in my code to any resource. Like, there are red lines all over the side bar although there's no red wiggly lines shown in the text editor. This latter problem is what really causing me headaches.

All this came after I updated to VS 15.7.1 from 15.6.*.

And one more thing, I'm using VS 2017 for Windows.

can anyone get the diagnostic log output for the intelligence build?

https://github.com/dotnet/project-system/blob/master/docs/design-time-builds.md#diagnosing-design-time-builds

Having the same issue.

Having the same issue in the latest stable vs mac

Had the same issue and couldnt work, so i downgraded to vs4mac 7.4, you can get the older files here, https://download.visualstudio.microsoft.com/download/pr/11757675/56a12386a77f392db07a63932790e3bc/VisualStudioForMac-7.4.0.1033.dmg. No issues after the downgrade. Just make sure to clean the caches folder

I also have this problem.
Any fixes?

Having the same issue.

If you dont mind downgrading to 7.4, use my solution above

Thanks @Nyconing, this solution solved my case too.

Thank @Nyconing , you are the best.

We merged a temporary fix into master. For those of you hitting this issue you can add

<AndroidUseManagedDesignTimeResourceGenerator Condition=" '$(AndroidUseManagedDesignTimeResourceGenerator)' == '' And '$(OS)' != 'Windows_NT' ">False</AndroidUseManagedDesignTimeResourceGenerator>

to your csproj. Note that we only disable this feature on Mac. VS2017 needs to have this feature for intelligence so just disabling AndroidUseManagedDesignTimeResourceGenerator across all platforms could cause problems on Windows.

I put dellis1972's code into PropertyGroup in csproj

<AndroidUseManagedDesignTimeResourceGenerator Condition=" '$(AndroidUseManagedDesignTimeResourceGenerator)' == '' And '$(OS)' != 'Windows_NT' ">False</AndroidUseManagedDesignTimeResourceGenerator>

It is not working. Intellisense still given error about Ambiguous reference.

But works fine if I put

<AndroidUseManagedDesignTimeResourceGenerator>False</AndroidUseManagedDesignTimeResourceGenerator>

.
_Windows10 pro version1803
VS2017 15.7.3
Xamarin.Android 8.3.3.2(head/dffc59120)_

We merged a temporary fix into master. For those of you hitting this issue you can add

False

to your csproj. Note that we only disable this feature on Mac. VS2017 needs to have this feature for intelligence so just disabling AndroidUseManagedDesignTimeResourceGenerator across all platforms could cause problems on Windows.

This worked for me. Thanks!

Was this page helpful?
0 / 5 - 0 ratings