类型的资源在名字空间不存在错误 [英] type resources does not exist in namespace error

查看:143
本文介绍了类型的资源在名字空间不存在错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

得到的另一个问题。我几乎完成了我的项目,但觉得我不得不改变项目的命名空间。但是,使用重构,而不是
- >重命名,我选择了我的空间,编辑 - >查找和替换,并在解决方案,其中例如命名空间或文本名称1用不同的命名空间取代了我的整个解决方案(这样无处不在存在,现在改为NAME2。)

Got another problem. I had almost finished my project but felt like I had to change the namespace of the project. But instead of using refactor --> rename , I selected my namespace, edit --> find and replace and replaced my whole solution with a different namespace (so everywhere in the solution where for example the namespace or text "name1" exists, is now changed into "name2").

但现在我得到大约16错误都说着同样的话:类型或命名空间的资源不。存在于命名空间名称1

But now I get around 16 errors all saying the same thing: "The type or namespace "resources" does not exist in namespace name1".

     this.centerPanel.BackgroundImage = global::login_DragDrop.Properties.Resources.oeftest;



因此,例如在这行代码(主要在designer.cs)资源为红色?

So for example in this line of code (mainly in the designer.cs) resources is colored red?

如何解决这个任何提示?

Any hints on how to fix this?

推荐答案

您需要在资源文件中运行代码生成,以获得正确的命名空间有作为。

You need to run the code generation on the resource file to get the correct namespace there as well.

请按照下列步骤操作:


  • 打开项目属性(右键点击>属性)

    • 单击应用区

    • 输入您的首选默认命名空间

    • 关闭并保存你的属性


    • 右键单点击Resources.resx文件

    • 选择运行自定义工具(或<大骨节病> ALT + <大骨节病>→

    • Right-click the Resources.resx file
    • Choose 'Run Custom Tool' (or alt+L)

    这再次运行代码生成资源文件。生成的代码,使您已经强类型访问您的资源字符串的值。

    This runs the code generation for the resource files again. The generated code makes that you have strongly typed access to the values in your resource strings.

    这篇关于类型的资源在名字空间不存在错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆