Could not find any resources appropriate for the specified culture or the neutral culture

后端 未结 30 1495
旧巷少年郎
旧巷少年郎 2020-11-28 20:15

I have two ASP.NET Web projects (ProjectA and ProjectB). When class in ProjectA is instantiating a class of ProjectB which uses a resource file Blah.resx, I get this error:

30条回答
  •  清酒与你
    2020-11-28 21:01

    This can be caused by mismatched namespaces. The second from top answer (Sibi Elango's) says to right-click the resx file, and change Build option to EmbeddedResource, but I had already done that and still had the error. The top answer (CFinck's) notes a way of fixing this via manually editing files, however, I had this problem in MonoDevelop, and had to set the default namespace to the same as the cs file which was calling for the resource (the file which contained code such as the code below)...

    this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
    

    After setting the default namespace via the GUI, the line above no longer caused an exception.

提交回复
热议问题