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

后端 未结 30 1571
旧巷少年郎
旧巷少年郎 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:19

    When I tried sharing a resource.resx file from one C# project with another C# project, I got this problem. The suggestion on moving the Form class to the beginning of its file wasn't appropriate. This is how I solved it. You essentially use a link from the second project to the first, then enable regeneration of the resource.designer.cs file.

    1. Delete the second project's Properties/Resources.resx file
    2. Add the first project's Properties/Resources.resx file as a LINK to the Properties folder in the second project. Don't add it to the root level of the project.
    3. Don't add the first project's Properties/Resources.designer.cs!
    4. On the properties of the second project's Resources.resx, add ResXFileCodeGenerator as the CustomTool
    5. Right click on the Resources.resx and select "Run Custom Tool". This will generate a new designer.cs file.

    Note: I would avoid editing the resource.designer.cs file, as this is autogenerated.

提交回复
热议问题