Xamarin Android - How to rebuild Resource.designer.cs

前端 未结 16 555
孤独总比滥情好
孤独总比滥情好 2021-02-03 17:10

In Xamarin Android - How to regenerate the Resource.designer.cs

I tried to mark all the XML file\'s Build Action as \"AndroidResource\" and still the Resource.designer.c

相关标签:
16条回答
  • 2021-02-03 17:39

    I had the exact same issue and none of the answers here worked. Finally I figured that I had some image references in some layouts that did not exist yet. It seems if you have a broken source path, Resource.Designer.cs stops updating without any error. Finally after removing the reference images, the issue was resolved and the Resource.Designer.cs got updated.

    Hope this helps someone!

    0 讨论(0)
  • 2021-02-03 17:40

    I solved this problem removing the character "-" from the name of images in Drawable folder.

    0 讨论(0)
  • 2021-02-03 17:40

    method1: Delete the file from the project and also delete bin and obj files and then build the project it should work 100% as i use to do that if i face the same problem if that doesn't work always there is another option

    method2: close the application i.e, visual studio, map to c-> users-> -> AppData (Hidden File) -> delete xamarin file from local and roaming

    0 讨论(0)
  • 2021-02-03 17:44

    I have found that Xamarin studio will stop regenerating the Resources file due to changes in the project file. The top build PropertyGroup should contain entries for

    <RootNamespace>**Your_Root_Namespace**</RootNamespace>
    <MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
    <MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
    <AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
    <AndroidApplication>True</AndroidApplication>
    <AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
    <AndroidResgenClass>Resource</AndroidResgenClass>
    <TargetFrameworkVersion>*your value here*</TargetFrameworkVersion>
    

    and for some reason these just disappear. If you open the csproj of the Android project with a text editor and add these entries it seems to work. I grabbed these entries from a fresh new project I created in Xamarin Studio that was working, which is possibly the easiest way to do this.

    0 讨论(0)
  • 2021-02-03 17:48

    1.Click Resource.designer.cs file from your project.

    2.Click CTRL+A (Select All)

    3.Click Del (Delete all)

    4.Clean and Rebuild your project(if you get message for modified Resource.designer.cs click "Yes to All" button).

    you are now get error for first buildings. but your Resource.designer.cs file is regenerated.you can now second build. its works.

    0 讨论(0)
  • 2021-02-03 17:48

    The Resource.designer.cs folder would update as @Brendan Zagaeski mentioned.

    However, since it seems like that didn't solve your problem it looks like Xamarin didn't recognize any of the changes you made. At least this is what happened to me.

    I ended up solving it by renaming the generated "Layout" folder to "layout" ( I did the same for drawable and values). After that, just by building the project again the Resource.Designer updated successfully.

    Hope this helps someone.

    0 讨论(0)
提交回复
热议问题