Visual Studio:类型或名称空间名称“属性"不存在 [英] Visual Studio: Type or namespace name 'Properties' does not exist
问题描述
这里有另一个线程,但是我的问题不一样.我最终找到了解决我特定问题的解决方案,以防其他人使用.我将其张贴在这里.
There's another thread here about this, but my problem was different. I eventually found the solution for my particular problem, which I'm posting here in case it's of use to others.
推荐答案
在项目的Properties文件夹中,应该(至少)有两个文件Resources.resx和Resources.Designer.cs,后者显示在下方Visual Studio的解决方案资源管理器中Resources.resx下的级别.就我而言,Resources.Designer.cs文件不再以某种方式包含在项目中.可以通过编辑(或还原.csproj文件)来解决此问题.
In a project's Properties folder there should be (at least) two files, Resources.resx and Resources.Designer.cs, with the latter file shown at a lower level under Resources.resx in Visual Studio's Solution Explorer. In my case the Resources.Designer.cs file was somehow no longer included in the project. This can be fixed by editing (or restoring an old copy of) the .csproj file.
And credit where credit is due, I found this solution here: http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/ebeca7a8-c7a3-4cb6-a40e-89c5fdb70c82 in the answer by NJLASSI.
修复此问题并不像我最初想象的那么简单,因此最好是有.csproj文件的旧副本可用,以便可以从此处恢复相关行.这是适用的行:
Fixing this isn't as simple as I first thought, so it's best if an old copy of the .csproj file is available so the relevant lines can be restored from there. Here are the applicable lines:
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
和
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
这篇关于Visual Studio:类型或名称空间名称“属性"不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!