Resource.Designer.cs生成器在调试时缺少资源 [英] Resource.Designer.cs generator missing resources on Debug
问题描述
我的IDE显示错误,抱怨我的资源不包含定义,一个例子是:
My IDE is showing errors complaining that my resources do not contain a definition, one example is:
'Resource.Dimension' does not contain a definition for 'screen_padding'
我的Android项目的Resources文件夹中的自动生成的Resource.Designer.cs文件具有该资源,但看来在我的项目的debug文件夹中还有另一个自动生成的Resource.Designer.cs文件,出于我未知的原因,这是不同的,我想是导致错误警告的原因.我必须从第一个复制到第二个,才能粘贴错误警告(不间断),但是它们很烦人.
The auto-generated Resource.Designer.cs file in the Resources folder of my Android project has the resources there, but it appears that there is another auto-generated Resource.Designer.cs file in the debug folder for my project, which for reasons unknown to me, is different and I guess is what is causing the error warnings. I'm having to copy/paste from the first in to the second to supress the error warnings (which are non-breaking), but they are annoying.
有什么办法解决吗,还是为什么调试REsource.Designer文件不镜像项目中的Resource.Designer文件?
Is there any way round this, or why does the debug REsource.Designer file not mirror the Resource.Designer file in the project?
推荐答案
您应将其放在.csproj文件中:<AndroidUseManagedDesignTimeResourceGenerator>False</AndroidUseManagedDesignTimeResourceGenerator>
.
You should put this inside of your .csproj file: <AndroidUseManagedDesignTimeResourceGenerator>False</AndroidUseManagedDesignTimeResourceGenerator>
.
为此,请关闭您的项目,打开.csproj文件并将其插入第一个<PropertyGroup>
中.我在<MonoAndroidAssetPrefix>Assets</MonoAndroidAssetPrefix>
To do that, close your project, open the .csproj file and insert it into the first <PropertyGroup>
. I inserted right after <MonoAndroidAssetPrefix>Assets</MonoAndroidAssetPrefix>
这篇关于Resource.Designer.cs生成器在调试时缺少资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!