CS0103 The name 'Resource' does not exist

DimChrisDimChris USMember ✭✭✭

In new version of xamarin with vs 2015 i get this message in every time i use resource.id

«1

Posts

  • locksmithlocksmith RUMember ✭✭

    I have the same. Xamarin 4.8.0.756. VS 2015.

  • LorenzettiLorenzetti BRMember ✭✭

    Same problem here.

  • locksmithlocksmith RUMember ✭✭

    There is no error if the project is generated in an earlier version of Xamarin.

  • DimChrisDimChris USMember ✭✭✭
    What you mean earlier?can i downgrade?
  • locksmithlocksmith RUMember ✭✭

    Projects generated in the version published before November.

  • DimChrisDimChris USMember ✭✭✭

    How can we avoid to install versions with bugs? Is there any way for downgrade in vs 2015?

  • locksmithlocksmith RUMember ✭✭

    The developers are silent.

  • Luis_dmLuis_dm USMember ✭✭✭

    Clean and Rebuild projects

  • DimChrisDimChris USMember ✭✭✭
    Didnt worked
  • locksmithlocksmith RUMember ✭✭

    Didnt worked too

  • seanydaseanyda GBMember ✭✭✭✭✭

    Update your Xamarin.Forms package to the latest, but don't update the Android.Support ones, They will be updated automatically with the Xamarin.Forms package because of the dependencies.

  • StracandidoStracandido USMember ✭✭
    edited January 2018

    Today I updated Xamarin for my Microsoft Visual Studio Community 2015 and I get the same problem. Until a month ago this problem did not arise.

    What happens is that I can build successfully the application and I can also deploy to my device without any problem, but when I write/edit the source code the error The name 'Resource' does not exist in the current context is always highlighted.

    The annoyance is that errors that do not exist are highlighted.

    My current configuration is:

    Xamarin 4.8.0.756 (64d469412)
    Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

    Xamarin Designer 4.8.188 (c5813fa34)
    Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

    Xamarin.Android 8.1.0.13 (f241f51)
    Visual Studio extension to enable development for Xamarin.Android.

    Xamarin.Android SDK 8.1.0.23 (HEAD/f65f87747)
    Xamarin.Android Reference Assemblies and MSBuild support.

    [EDITED on 03/01/2018]

    I opened the bug report 61135

  • CharwakaCharwaka INMember ✭✭✭✭✭

    Hi @DimChris @locksmith

    Try adding Namespace before Resource , or try to add new activity and replace all content with your current activity

  • StracandidoStracandido USMember ✭✭

    Hello,

    I tried to add the Namespace before Resource but the problem persists...

  • CharwakaCharwaka INMember ✭✭✭✭✭
    edited January 2018

    HI @Stracandido @DimChris @locksmith

    Check for intellisense with Droid or droid name after ClientApp

    Let say you project structure will be

    ClientApp.Portable
    ClientApp.Droid
    ClientApp.iOS

    Then you should use

    ClientApp.Droid.Resource

  • StracandidoStracandido USMember ✭✭

    Hello,

    I tried to create a new Activity [i.e. MainActivityTBR] and replace the whole content with that of my current Activity [i.e. MainActivity] as suggested by @Charwaka

    I then cleaned the solution and I rebuilt it again.

    The recipe seemed to work.

    I then closed the solution and also VS. I restarted VS and opened the solution but the problem has reoccurred...

  • CharwakaCharwaka INMember ✭✭✭✭✭
    edited January 2018

    @Stracandido said:
    Hello,

    I tried to create a new Activity [i.e. MainActivityTBR] and replace the whole content with that of my current Activity [i.e. MainActivity] as suggested by @Charwaka

    I then cleaned the solution and I rebuilt it again.

    The recipe seemed to work.

    I then closed the solution and also VS. I restarted VS and opened the solution but the problem has reoccurred...

    Try deleting **Resource.Designer.cs file ->Rebuild and check **

    **Change the project Deafult NameSpace like

    ClientApp->ClientApps->Rebuild and check**
    

    Try unloading & Reloading Resources Folder ->Rebuild and check

  • StracandidoStracandido USMember ✭✭

    @Charwaka said:
    HI @Stracandido @DimChris @locksmith

    Check for intellisense with Droid or droid name after ClientApp

    Let say you project structure will be

    ClientApp.Portable
    ClientApp.Droid
    ClientApp.iOS

    Then you should use

    ClientApp.Droid.Resource

    Hi @Charwaka

    Intellisense does not provide any 'Droid' or 'droid' after ClientApp

  • CharwakaCharwaka INMember ✭✭✭✭✭

    @Stracandido said:

    @Charwaka said:
    HI @Stracandido @DimChris @locksmith

    Check for intellisense with Droid or droid name after ClientApp

    Let say you project structure will be

    ClientApp.Portable
    ClientApp.Droid
    ClientApp.iOS

    Then you should use

    ClientApp.Droid.Resource

    Hi @Charwaka

    Intellisense does not provide any 'Droid' or 'droid' after ClientApp

    is your project Name is "ClientApp.Droid" in the Solution Explorer ?

  • seanydaseanyda GBMember ✭✭✭✭✭

    Had this issue too many times. There is no point playing around with the Resource.Designer.cs file because it's generated at runtime so you will have to keep repeating the process to fix it. You need to use a different Xamarin.Forms package and that will tend to fix it for me, also close Visual Studio and reopen it.

  • StracandidoStracandido USMember ✭✭

    @Charwaka said:

    @Stracandido said:

    @Charwaka said:
    HI @Stracandido @DimChris @locksmith

    Check for intellisense with Droid or droid name after ClientApp

    Let say you project structure will be

    ClientApp.Portable
    ClientApp.Droid
    ClientApp.iOS

    Then you should use

    ClientApp.Droid.Resource

    Hi @Charwaka

    Intellisense does not provide any 'Droid' or 'droid' after ClientApp

    is your project Name is "ClientApp.Droid" in the Solution Explorer ?

    The project name is ClientApp as well as the Namespace

    The project was created a couple of years ago (with that name and that namespace) and only now, after installing the latest version of Xamarin 4.8.0.756, the problem occurs.

  • CharwakaCharwaka INMember ✭✭✭✭✭

    @Stracandido said:

    @Charwaka said:

    @Stracandido said:

    @Charwaka said:
    HI @Stracandido @DimChris @locksmith

    Check for intellisense with Droid or droid name after ClientApp

    Let say you project structure will be

    ClientApp.Portable
    ClientApp.Droid
    ClientApp.iOS

    Then you should use

    ClientApp.Droid.Resource

    Hi @Charwaka

    Intellisense does not provide any 'Droid' or 'droid' after ClientApp

    is your project Name is "ClientApp.Droid" in the Solution Explorer ?

    The project name is ClientApp as well as the Namespace

    The project was created a couple of years ago (with that name and that namespace) and only now, after installing the latest version of Xamarin 4.8.0.756, the problem occurs.

    First try like this

    ClientApp.Resource

    if dont work try following steps

    **Change the project Deafult NameSpace like

    ClientApp->ClientApps->Rebuild and check**
    Try unloading & Reloading Resources Folder ->Rebuild and check

  • CharwakaCharwaka INMember ✭✭✭✭✭

    @seanyda said:
    Had this issue too many times. There is no point playing around with the Resource.Designer.cs file because it's generated at runtime so you will have to keep repeating the process to fix it. You need to use a different Xamarin.Forms package and that will tend to fix it for me, also close Visual Studio and reopen it.

    not in every case

  • StracandidoStracandido USMember ✭✭
    edited January 2018

    @Charwaka said:

    @Stracandido said:

    @Charwaka said:

    @Stracandido said:

    @Charwaka said:
    HI @Stracandido @DimChris @locksmith

    Check for intellisense with Droid or droid name after ClientApp

    Let say you project structure will be

    ClientApp.Portable
    ClientApp.Droid
    ClientApp.iOS

    Then you should use

    ClientApp.Droid.Resource

    Hi @Charwaka

    Intellisense does not provide any 'Droid' or 'droid' after ClientApp

    is your project Name is "ClientApp.Droid" in the Solution Explorer ?

    The project name is ClientApp as well as the Namespace

    The project was created a couple of years ago (with that name and that namespace) and only now, after installing the latest version of Xamarin 4.8.0.756, the problem occurs.

    First try like this

    ClientApp.Resource

    if dont work try following steps

    **Change the project Deafult NameSpace like

    ClientApp->ClientApps->Rebuild and check**
    Try unloading & Reloading Resources Folder ->Rebuild and check

    Hi @Charwaka

    I've already tried to put the Namespace [ClientApp] before Resource but without success.

    I changed the Namespace from ClientApp to ClientApps, I changed also the Default Namespace from ClientApp to ClientApps, so I deleted the file Resource.Designer.cs, cleaned the solution and then rebuilt everything by adding the new regenerated file Resource.Designer.cs in the Resource folder.

    I successfully deleted the Resources folder from the project. I cleaned the solution then I closed the project and I restarted VS.

    I copied a copy of the same folder into the project tree and I included it again in the project.

    I rebuilt everything but the problem persists...

  • DimChrisDimChris USMember ✭✭✭

    I made a clean install of Visual Studio and xamarin in default install version and problem solved.

  • speschkaspeschka Member

    Same exact problem as others in here and has ground things to a near halt. Adding namespace identifiers in the code itself doesn't change anything because the resources class uses the default app namespace. I also got this when updating Xamarin tools this week. The process is hideous - make changes, do a build, run it - everything works. As soon as it's run once, then the Resource class can no longer be found...even if you do absolutely nothing else, like not a single keystroke. Then you can clean the project and try to rebuild it, and every now and then it will fix it, but many times now it doesn't. The only cure has been to close Visual Studio, restart, reload the project, do a clean, and rebuild. Every single time I make changes. This is totally unsustainable.

  • DimChrisDimChris USMember ✭✭✭

    I think its xamarin's bug. Probably it will be fixed in a new version. If someone from developers knows any way for fixing our problem please let us know.

  • locksmithlocksmith RUMember ✭✭

    I tried using the installer to fix the problem. Did not help.

  • StracandidoStracandido USMember ✭✭

    @DimChris said:
    I think its xamarin's bug. Probably it will be fixed in a new version. If someone from developers knows any way for fixing our problem please let us know.

    Me too...

    In fact I opened this public bug report 61135 a week ago

  • StracandidoStracandido USMember ✭✭

    I removed Microsoft Visual Studio Community 2015 [and whole Xamarin Tools] and installed Microsoft Visual Studio Community 2017 successfully.

    Microsoft Visual Studio Community 2017
    Version 15.5.2
    VisualStudio.15.Release/15.5.2+27130.2010
    Microsoft .NET Framework
    Version 4.7.02053

    Xamarin 4.8.0.753 (6575bd113)
    Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

    Xamarin Designer 4.8.188 (c5813fa34)
    Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

    I opened my project that highlighted the problem by discovering that with this new version of the IDE the problem has disappeared.

    I think it's a bug of Xamarin in this configuration:

    Microsoft Visual Studio Community 2015
    Version 14.0.25431.01 Update 3
    Microsoft .NET Framework
    Version 4.7.02053

    Xamarin 4.8.0.756 (64d469412)
    Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

    Xamarin Designer 4.8.188 (c5813fa34)
    Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

  • Facing the same issue

    Microsoft Visual Studio 2015
    Version 14.0.25421.03 Update 3
    Microsoft .NET Framework
    Version 4.6.01038

    Xamarin 4.8.0.756 (64d469412)

    Xamarin Designer 4.8.188 (c5813fa34)

    Xamarin.Android 8.1.0.13 (f241f51)
    Xamarin.Android SDK 8.1.0.23 (HEAD/f65f87747)

    Any workaround or fix for Visual Studio 2015

  • SteveGraySteveGray GBMember ✭✭

    Experiencing this also. Got nothing done for two days.

  • VisVis Member ✭✭

    Any change in bugs occurred in visual studio 2015 ??????

  • DimChrisDimChris USMember ✭✭✭

    No yet last version 4.8.0.756 still have this issue

  • I'm using Visual Studio for Mac version 7.3.3 and I have the same issue

  • GaryDixGaryDix NZMember ✭✭

    So I had a number of issues (see my other post) and I installed VS Preview, and loaded it up, build a new project and it worked!

    Joyfully I made my simple project then tried to change my Namespace to something more appropriate it was (XamDeleteMe) . That killed it.

    So I made a new project, copied over the code, piece by piece building it as it went. and it failed with CS0103: The name 'Resource' does not exist in the current context

    Nothing I can do has changed it. New project, new VS, still doesn't post. It seems to me that there is a second place that the Resource is moved to on build and in that place there is not a link to the resource designer, because there is no error until you build it.

    It seems nothing to do with what we can work with, but something behind the scenes in the build process is broken.

  • GaryDixGaryDix NZMember ✭✭

    I made a new project cut and pasted my code across again. built it every time. It worked.
    Then I added 2 buttons to the bottom of the activity. It died. Back to the same error.

    Delete the buttons out, it works. Add them in again, it works. Totally random ......

  • DimChrisDimChris USMember ✭✭✭

    This problem has been fixed in new xamarin's version. The problem i have now is that i'm getting blank screen on layout designer
    https://forums.xamarin.com/discussion/123159/layout-black-screen#latest

  • ScottRFrostScottRFrost USMember ✭✭

    I'm having this same issue with everything up to date as of today, I don't think it's fixed.

  • DimChrisDimChris USMember ✭✭✭

    No it isn't fixed yet. Maybe in a future xamarin's version.

Sign In or Register to comment.