Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2015 Xamarin.Android: Intellisense can't see Resource.designer.cs

I'm using Visual Studio 2015 with Xamarin.Android. My solution compiles and links fine, with no warnings or errors. It runs correctly on my target device.

However, Intellisense can't find the autogenerated Resource.designer.cs file (which provides all the resource ID constants for things like page design elements from .axml files, string resources, assets and so on).

If I have code like: var button = FindView(Resource.Id.some_button);, then in the edit window the "Resource" part will have a red underline, and if I mouse over it, I see: "The name 'Resource' does not exist in the current context."

In the Output window, if I change the dropdown to show output from Intellisense, I see a line like:

[Failure] Could not find file 'C:\Users\dghenke\Downloads\Widget\Widget\Widget.Android\obj\Debug\designtime\Resource.Designer.cs'.

That path exists up to the Debug\ folder, but there is no designtime\ folder underneath.

Things I have tried:

  • Closing and re-opening Visual Studio.
  • "Clean Solution" followed by "Build Solution".
  • Completely removing my source tree then fetching a fresh copy from source control.
  • Checking my .csproj file to make sure that <MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix> <AndroidResgenClass>Resource</AndroidResgenClass> <AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile> is in the first <PropertyGroup> element.
  • Removing the Resource.designer.cs file from the project and re-adding it.

Things I have not tried (and would prefer to keep it that way): Creating a whole new solution from scratch then manually re-adding all my source files from the original.

Versions:

  • Visual Studio Professional 2015 14.0.25431.01 Update 3
  • Xamarin 4.8.0.756
  • Xamarin.Android 8.1.0.13
like image 889
Douglas Henke Avatar asked Dec 07 '25 09:12

Douglas Henke


1 Answers

What finally worked for me was addding:

<AndroidUseManagedDesignTimeResourceGenerator>False</AndroidUseManagedDesignTimeResourceGenerator>

to the first PropertyGroup in my .csproj file.

like image 133
Douglas Henke Avatar answered Dec 09 '25 03:12

Douglas Henke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!