Search code examples
.netvisual-studioc++-clivisual-studio-2019

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


Hello so recently on my project I changed the icon of the window form app on the properties > window Style > Icon Here is the icon I chose:

,but whenever I launch my app, I get this error:

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.'

at this line:

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

$this.Icon corresponds to hello.ico.

Any idea on how I could fix that?

Thanks in advance.


Solution

  • Fixed my problem by inspiring myself from this article, changing my own code to this:

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