简体   繁体   English

Resource.Designer.cs:“资源...不包含...的定义”

[英]Resource.Designer.cs: “Resource … does not contain a definition for …”

today I updated the NuGet packages for our Android version (we are currently developing for Android and iOS). 今天我更新了Android版的NuGet包(我们目前正在为Android和iOS开发)。 After the updates I cannot build the Android version anymore. 更新后,我无法再构建Android版本了。 This is an issue I faced everytime after updating packes so far, but this time I can't solve this problem. 这是我到目前为止每次更新包装后遇到的问题,但这次我无法解决这个问题。 Usually restarting Xamarin or Reinstalling the NuGet packages helped. 通常重启Xamarin或重新安装NuGet包有帮助。

I have 151 error messages like this one: 我有151条错误消息,如下所示:

/Users/Username/Projects/MyAppName/Droid/Resources/Resource.designer.cs(118,118): Error CS0117: >MyAppName.Droid.Resource.Attribute' does not contain a definition for mediaRouteSettingsDrawable' (CS0117) (MyAppName.Droid) /Users/Username/Projects/MyAppName/Droid/Resources/Resource.designer.cs(118,118):错误CS0117:> MyAppName.Droid.Resource.Attribute'不包含mediaRouteSettingsDrawable的定义'(CS0117)(MyAppName.Droid)

Here are all the steps I already did trying to fix this problem (in this order): 以下是我尝试解决此问题的所有步骤(按此顺序):

  1. Build --> Clean all 建立 - >清理所有
  2. Uninstall every NuGet package from every project (Droid, iOS, SyncLibrary (own library for SQL server communication) and UITest) 从每个项目卸载每个NuGet包(Droid,iOS,SyncLibrary(用于SQL服务器通信的自有库)和UITest)
  3. Delete everything inside of file "Resource.Designer.cs" 删除文件“Resource.Designer.cs”中的所有内容
  4. Close Xamarin 关闭Xamarin
  5. Install every package in the SDK Manager for every version 在SDK Manager中为每个版本安装每个软件包
  6. Delete the packages folder of the solution 删除解决方案的packages文件夹
  7. Delete content of /Users/Username/.local/share/Xamarin 删除/Users/Username/.local/share/Xamarin的内容
  8. Delete content of /Users/Username/.local/share/NuGet/cache 删除/Users/Username/.local/share/NuGet/cache的内容
  9. Start Xamarin 启动Xamarin
  10. Add Newtonsoft.Json package to SyncLibrary 将Newtonsoft.Json包添加到SyncLibrary
  11. Add Android packages: only add the needed packages, let NuGet resolve dependencies (like Xamarin.Android.Support, Xamarin.GooglePlayServices etc.) on its own. 添加Android软件包:只添加所需的软件包,让NuGet自行解决依赖关系(如Xamarin.Android.Support,Xamarin.GooglePlayServices等)。 Installed packages (in this order): 已安装的包(按此顺序):

    Xamarin.Forms.......................................(2.2.0.45) Xamarin.Forms .......................................(2.2.0.45)
    Xamarin.Forms.Maps...........................(2.2.0.45) Xamarin.Forms.Maps ...........................(2.2.0.45)
    XLabs.Forms............................................(2.0.5782) XLabs.Forms ............................................(2.0。 5782)
    ZXing.Net.Mobile..................................(2.0.4.46) ZXing.Net.Mobile .............................(2.0.4.46)
    Newtonsoft.Json....................................(8.0.3) Newtonsoft.Json ....................................(8.0.3)
    Xam.Plugin.Geolocator........................(3.0.4) Xam.Plugin.Geolocator ........................(3.0.4)

  12. Build --> Clean all 建立 - >清理所有

  13. Restart Xamarin 重启Xamarin
  14. Build new: SyncLibrary (so there's no dependency error when trying to build the Android version) 构建新的:SyncLibrary(因此在尝试构建Android版本时没有依赖性错误)
  15. Build new: Android version --> Error 构建新:Android版本 - >错误

I really don't know what to do anymore. 我真的不知道该怎么做了。 Any help / ideas are appreciated, thanks in advance. 任何帮助/想法都表示赞赏,提前谢谢。

Xamarin.Forms...(2.2.0.45) Xamarin.Forms ...(2.2.0.45)

XLabs.Forms.....(2.0.5782) XLabs.Forms .....(2.0.5782)

That's the point. 这才是重点。 The last stable Xamarin.Forms has some problems that may cause build errors when you're using XLabs or another library. 最后一个稳定的Xamarin.Forms有一些问题,当你使用XLabs或其他库时可能会导致生成错误。

The only solution which I know is to use pre-release version of XLabs.Forms - 2.2.0-pre02 . 我知道的唯一解决方案是使用预发布版本的XLabs.Forms - 2.2.0-pre02

In my case I updated XLabs packages and cleared/rebuild my solutions. 在我的情况下,我更新了XLabs包并清除/重建我的解决方案。

More info in XLabs issue tracker and Xamarin Bugzilla . 有关XLabs问题跟踪器Xamarin Bugzilla的更多信息。

I've experienced similar errors, but didn't use XLabs.Forms. 我遇到过类似的错误,但没有使用XLabs.Forms。 I saw, that you used ZXing.Net.Mobile also, as me - I've updated that to newest pre-release (in the time of writing: 2.1.0-beta1) and it also helpep. 我看到,你也使用ZXing.Net.Mobile,就像我一样 - 我已经更新到最新的预发行版(在编写本文时:2.1.0-beta1),它也有助于它。

I have the same problem with mine Xamarin solution 我的Xamarin解决方案也有同样的问题

have you tried: 你有没有尝试过:

  • Exit Visual Studio 退出Visual Studio
  • Deleting c:\\Users\\username\\AppData\\Local\\Xamarin 删除c:\\ Users \\ username \\ AppData \\ Local \\ Xamarin
  • Open the solution again 再次打开解决方案
  • Compile, wait until it finishes completely. 编译,等到它完全完成。

Anyway, found this link, maybe it was useful: Xamarin: Build action EmbeddedResource 无论如何,发现这个链接,也许它很有用: Xamarin:构建动作EmbeddedResource

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM