System.Resources.MissingManifestResourceException 带有图标文件的错误 C++/CLi

System.Resources.MissingManifestResourceException error C++/CLi with icon file

你好,最近在我的项目中,我在 properties > window Style > Icon 上更改了 window 表单应用程序的图标 这是我选择的图标:

,但每当我启动我的应用程序时,我都会收到此错误:

System.Resources.MissingManifestResourceException: 'Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "formApp.MyForm.resources" was correctly embedded or linked into assembly "formApp" at compile time, or that all the satellite assemblies required are loadable and fully signed.'

在这一行:

this->Icon = (cli::safe_cast<System::Drawing::Icon^>(resources->GetObject(L"$this.Icon")));

$this.Icon对应hello.ico.

知道如何解决这个问题吗?

提前致谢。

通过从这个 article 中启发自己解决了我的问题,将我自己的代码更改为:

this->Icon = gcnew System::Drawing::Icon("your_ico_fil_path");