I keep getting a culture error despite trying everything. 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);
}
}
I have tried every possible way and it is not working
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.
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 includes special chars
Played too much times with "CultureInfo.InvariantCulture" in Resources.cs's internal static byte[] med => (byte[]) Properties.Resources.ResourceManager.GetObject(nameof (medus1), CultureInfo.InvariantCulture);
line
I 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 in internal static byte[] med => (byte[]) Properties.Resources.ResourceManager.GetObject(nameof (med), CultureInfo.InvariantCulture);
line. If you can adapt this please let me know
My resx file's build action option is already Embedded Resource
Already I don't have Properties/Resources.designer.cs
file
My 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