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

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

    Sibi Elangos answer alone was not sufficient for me, so I had to

    • Right click on your ResourceFile
    • Change the "Build Action" property
    • Compile to "Embedded Resource"
    • Build and deploy

    This will generate an App_GlobalResources in your /bin folder, now copy that folder also to the root of the web application

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

    No-one seems to have mentioned this solution. Obvious really - but tripped me over for a moment...

    The default access modifier for a new resources file is Internal (or Friend in VB.Net.) Make sure you change this to Public

    (in the resx designer there is a dropdown at the top for the access modifier)

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

    Right-click on the resources and select Run Custom Tool

    This will fix the designer

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

    In my case I had placed a new class on top of a Windows form, within the same file.

    Moving the newly added class out of that file fixed the problem.

    See here: http://i.stack.imgur.com/wVu6c.png

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

    This can also occur when putting a class above the main winform class (Form1, for example) You can see this when you look at the design, as it fails to be rendered.

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

    For users who facing this isssue in .NET Core 3.0, this could be related to a breaking change that made in .NET Core 3.0, to resolve it just set EmbeddedResourceUseDependentUponConvention to false in your project csproj:

    <PropertyGroup>
      <EmbeddedResourceUseDependentUponConvention>false</EmbeddedResourceUseDependentUponConvention>
    </PropertyGroup>
    
    0 讨论(0)
提交回复
热议问题