Mori
Mori

Reputation: 1

Visual Studio Community 2022 - Server Error related to App_GlobalResourcesLang.resources

We created a multi-language C# .NET webform website in Visual Studio Community 2022.

When the website is browsed in the computers with Visual Studio installed, everything is fine. However, when the website is browsed in the computers without Visual Studio, there is an error:

Server Error in '/dev/websitename' Application. Stack Trace:

[MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "ProjectName.App_GlobalResources.Lang.resources" was correctly embedded or linked into assembly "ProjectName" at compile time, or that all the satellite assemblies required are loadable and fully signed.] System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String fileName) +441 System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark) +1219 System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark) +1008 System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark) +1008 System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) +43 System.Resources.ResourceManager.GetString(String name, CultureInfo culture) +567 Projectname.filename.funcationname() in C:\Users\Path\filename.aspx.cs:80 System.Web.UI.Control.OnLoad(EventArgs e) +108 System.Web.UI.Control.LoadRecursive() +90 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1533 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4330.0

The function causes the error that gets the text to show based on the language selected. In the function, the scripts are:

Thread.CurrentThread.CurrentCulture = new CultureInfo(Session["Lang"].ToString());
rm = new ResourceManager("ProjectName.App_GlobalResources.Lang", Assembly.GetExecutingAssembly());
ci = Thread.CurrentThread.CurrentCulture;

The properties of the languages resx files are:

  1. Build Action: Embedded Resources
  2. Custom Tool: GlobalResourceProxyGenerator
  3. Copy to Output Directory: Do not copy

We tried

  1. Change the setting to : Copy if newer
  2. Use a new resx files but still failed.

Is there any way we can solve this error? Many Thanks

Upvotes: 0

Views: 361

Answers (0)

Related Questions