简体   繁体   English

Xamarin Resource.Designer.cs 不刷新新 ID 或事件

[英]Xamarin Resource.Designer.cs not refreshing new id's or events

So im working in Xamarin and i had a problem with my events and layouts because i added new stuff but the layouts didn't refresh they just kept displaying the old layouts and the new events i added had the same problem they are just ignoring my new code i already saw a few links and they said this happens because the Resource.Designer.cs is not refreshing but never gave any solutions any ideas?所以我在 Xamarin 工作,我的事件和布局有问题,因为我添加了新东西,但布局没有刷新,他们只是继续显示旧布局,我添加的新事件也有同样的问题,他们只是忽略我的新事件代码我已经看到了一些链接,他们说这是因为 Resource.Designer.cs 没有刷新但从未给出任何解决方案任何想法? . .

UPDATE: There are no build errors but still the layouts won't refresh.更新:没有构建错误,但布局仍然不会刷新。

它在VS2017中一直发生在我身上,诀窍是在你的布局的“自定义工具”属性中重新添加“MSBuild:UpdateGeneratedFiles”。

好的,首先感谢大家的帮助,问题只发生在我的一个布局(登录)上,其他人正在更新,这个问题正在发生,因为我从另一个解决方案中导入了这个布局,我之前做的有问题一个.gif文件并从该1º解决方案中删除了一些文件我创建了另一个布局,并且工作正常,谢谢大家。

I'm having the same issue: this is the official Xamarin answer (which isn't particularly great for people unable to update to version 5.0 +): 我遇到了同样的问题:这是官方的Xamarin答案(对于无法更新到5.0 +版本的人来说,这不是特别好):

https://developer.xamarin.com/guides/android/troubleshooting/questions/resource-designer-wont-update/ https://developer.xamarin.com/guides/android/troubleshooting/questions/resource-designer-wont-update/

Options: 选项:

1) Manually edit your .csproj file (eww) 1)手动编辑.csproj文件(eww)

2) Create a brand new project and copy your resources (disgusting) 2)创建一个全新的项目并复制你的资源(恶心)

3) Update. 3)更新。

I wish I could be more helpful... 我希望我能更有帮助......

Usually, simply modifying anything in Android Resources will rebuild the Resource.Designer.cs file eg changing a view id in a layout.通常,简单地修改 Android 资源中的任何内容都会重建 Resource.Designer.cs 文件,例如更改布局中的视图 ID。

In my case I changed a file name in resource/layout dir.就我而言,我更改了资源/布局目录中的文件名。 This caused an error in my .csproj where the filename was changed in the file system but the .csproj was still referencing the old name.这导致我的 .csproj 出现错误,其中文件系统中的文件名已更改,但 .csproj 仍在引用旧名称。

This caused the Android Resource.Designer generator to fail with no obvious reason.这导致 Android Resource.Designer 生成器在没有明显原因的情况下失败。 Once I removed the stale reference from my Android .csproj file and added the proper one, the Resource.Designer was generated successfully.一旦我从我的 Android .csproj 文件中删除了陈旧的引用并添加了正确的引用,Resource.Designer 就成功生成了。

Project Clean & rebuild the solution/project normally solves the issue. 项目清理和重建解决方案/项目通常可以解决问题。

Usually this condition is seen if you have build/compile issues with your code, axml, etc.. and thus the generated-code/code-behind file can not be created. 通常,如果您的代码,axml等存在构建/编译问题,则会出现这种情况。因此无法创建生成的代码/代码隐藏文件。

If you can reproduce this issue, I would highly recommend adding to this open issue: 如果您可以重现此问题,我强烈建议您添加此问题:

Note: You can also try the current alpha/beta cycle release if you can not currently on that release channel 注意:如果您当前无法在该发布渠道上,也可以尝试当前的alpha / beta周期版本

尝试从模拟器/设备卸载现有应用程序,然后清理解决方案,重建并运行。

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

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