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

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

    I faced this issue for running Migration command.Update-Database in Package Manager console.

    Accepted answer didn't solve my problem.

    I had to change Build Action from Compile to Embedded Resource and It worked for me.

    You can do the same using below steps:

    1. Right click on migration.
    2. Change the "Build Action" property "Compile" to "Embedded Resource"
    3. Run Update-Database command.
    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2020-11-28 21:19

    Double Click properties in Application section check Assembly name and default namespace are the same

    0 讨论(0)
  • 2020-11-28 21:21

    It happens because the *.resх is excluded from migration.

    • Right click on your ResourceFile
    • Click on the menu item "Include in project"
    0 讨论(0)
  • 2020-11-28 21:21

    I have a WinForms application with a single project in the solution.
    Targeting .NET Framework 4.0
    Using SharpDevelop 4.3 as my IDE

    Sounds silly, but I happened to have the Logical Name property set to "Resources" on my "Resources.resx" file. Once I cleared that property, all works hunky-dory.

    Normally, when you add random files as EmbeddedResource, you generally want to set the Logical Name to something reasonable, for some reason, I did the same on the Resources.resx file and that screwed it all up...

    Hope this helps someone.

    0 讨论(0)
  • 2020-11-28 21:22

    I found that deleting the designer.cs file, excluding the resx file from the project and then re-including it often fixed this kind of issue, following a namespace refactoring (as per CFinck's answer)

    0 讨论(0)
提交回复
热议问题