.net MenuStrip的MissingManifestResourceException错误以及如何修复它

8mmmxcuj  于 2023-10-21  发布在  .NET
关注(0)|答案(1)|浏览(119)

我试图迁移旧项目(游戏编辑器)从Visual Studio 2008与net 2.0似乎与net 4.8的vs 2022,可悲的是,我不熟悉dotnet,并在编辑器启动过程中遇到错误。
System.Resources.MissingManifestResourceException:'找不到适合指定区域性或非特定区域性的任何资源。请确保“editor.window_ide.resources”在编译时正确嵌入或链接到程序集“editor”中,或者确保所需的所有附属程序集都已删除并完全签名。
最后一行的问题:
resources->ApplyResources(this->menuStrip, L"menuStrip"); this->menuStrip->Name = L"menuStrip";
基本上似乎所有的创建标准的方式与默认的编辑器命名空间。相应宣布的资源:

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

namespace editor {

    public ref class window_ide : public System::Windows::Forms::Form
    {
        typedef Form    super;
    public:
        window_ide( editor_world& world ) :
            m_editor_world          ( world )
        {
            InitializeComponent();
            //
            //TODO: Add the constructor code here
            //
            in_constructor  ( );
        }

    protected:
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        ~window_ide()
        {
            if (components)
            {
                delete components;
            }

            custom_finalize ( );
        }

private:
    /// <summary>
    /// Required designer variable.
    /// </summary>
    System::ComponentModel::Container^ components;

private: System::Windows::Forms::MenuStrip^  menuStrip;

#pragma region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        void InitializeComponent(void)
        {
                  System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(window_ide::typeid));

               // other declared components

          this->menuStrip = (gcnew System::Windows::Forms::MenuStrip());

          this->menuStrip->SuspendLayout();

          this->SuspendLayout();

            // menuStrip
this->menuStrip->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(5) {this->FileMenuItem, this->EditMenuItem, this->ViewMenuItem, this->ToolsMenuItem, this->HelpMenuItem});
            this->menuStrip->SuspendLayout();
            resources->ApplyResources(this->menuStrip, L"menuStrip");
            this->menuStrip->Name = L"menuStrip";
        }
#pragma endregion
};
} // namespace editor

我尝试编辑resx file并将menuStrip.Name值更改为类似System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089的值,或者只是在resx中创建MenuStrip字符串并添加相同的内容。虽然没有帮助,但这怎么能解决呢?对不起,我想这可能是一个愚蠢的问题。

7lrncoxx

7lrncoxx1#

确定这一点,你需要检查.resx的“资源逻辑名称”并手动设置它,或者更好地为每个项目在宏中创建根命名空间,并将其添加到.resx的“逻辑名称”,类似于:$(根目录空间).%(文件夹). resources.

相关问题