I keep getting a culture error and I'm unable to resolve it. I've tried to iterate on the issue, previously raised a question that was closed and implemented various solutions without any success. Details of all tested solutions are mentioned at the end of the question. Here are my two files:
First file (main code):
using Properties;
using System;
using System.IO;
namespace malt
{
class Programs
{
static void Main(string[] args)
{
byte[] med = Properties.Resources.med;
Console.WriteLine(med);
}
}
}
Second file (Resources.cs in the same folder as Resources.resx):
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.Resources;
using System.Runtime.CompilerServices;
namespace Properties
{
internal sealed class Resources
{
private static ResourceManager resourceMan;
public static CultureInfo resourceCulture = CultureInfo.InvariantCulture;
internal Resources()
{
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (Properties.Resources.resourceMan == null)
Properties.Resources.resourceMan = new ResourceManager("Properties.Resources", typeof (Properties.Resources).Assembly);
return Properties.Resources.resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get => Properties.Resources.resourceCulture;
set => Properties.Resources.resourceCulture = value;
}
internal static byte[] med => (byte[]) Properties.Resources.ResourceManager.GetObject(nameof (med), CultureInfo.InvariantCulture);
}
}
Full error:
Could not find any resources appropriate for the specified culture or the neutral culture. Make sure that "Properties.Resources.resources" was correctly embedded or linked into assembly "madt" at compile time, or that all the satellite assemblies required are loadable and fully signed.
Note I asked this question before, but although the address it directed was not a solution, it closed the question and did not reopen it even though I edited it. That's why I asked again :)
List of things I've tried:
Before saying this link is an answer and closing the question Could not find any resources appropriate for the specified culture or the neutral culture:
The Compilation Action property of my .resx file is Embedded and still not works
Both of files are not including any special chars
I've played too much time with "CultureInfo.InvariantCulture" in Resources.cs's
internal static byte[] med => (byte[]) Properties.Resources.ResourceManager.GetObject(nameof (medus1), CultureInfo.InvariantCulture);
lineI've also tried the answers to the previously asked questions but it didn't work
I don't have a function like this in my code
ProblemAssembly.Support
. My problem is ininternal static byte[] med => (byte[]) Properties.Resources.ResourceManager.GetObject(nameof (med), CultureInfo.InvariantCulture);
line. If you can adapt this please let me knowMy resx file's build action option is already Embedded Resource
Already I don't have
Properties/Resources.designer.cs
fileMy resx file is already included in project
I don't use .NET Core 3.0
Tried to change CultureInfo type to public, private, internal but no one has been worked
Tried to change project name
If I use try catch for escaping from this error, my code will not work and nothing will be different