VS2015 Xamarin.Android: Intellisense 看不到 Resource.designer.cs

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

我正在使用 Visual Studio 2015 和 Xamarin.Android。我的解决方案可以正常编译和链接,没有任何警告或错误。它在我的目标设备上运行正常。

但是,Intellisense 无法找到自动生成的 Resource.designer.cs 文件(它为 .axml 文件中的页面设计元素、字符串资源、资产等提供所有资源 ID 常量)。

如果我有这样的代码:var button = FindView(Resource.Id.some_button);,那么在编辑 window 中,"Resource" 部分会有红色下划线,如果我将鼠标悬停在它上面,我会看到:"The name 'Resource' does not exist in the current context."

在输出 window 中,如果我更改下拉菜单以显示 Intellisense 的输出,我会看到如下一行:

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

该路径一直存在到 Debug\ 文件夹,但下面没有 designtime\ 文件夹。

我尝试过的事情:

我没有尝试过的事情(并且更愿意保持这种方式):从头开始创建一个全新的解决方案,然后手动重新添加我所有的源文件。

版本:

最终对我有用的是添加:

<AndroidUseManagedDesignTimeResourceGenerator>False</AndroidUseManagedDesignTimeResourceGenerator>

到我的 .csproj 文件中的第一个 PropertyGroup