| |

VerySource

 Forgot password?
 Register
Search
View: 754|Reply: 3

About the use of asp.net resource files

[Copy link]

2

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-23 02:30:01
| Show all posts |Read mode
Failed to find any resources suitable for the specified culture or non-specific culture. Please ensure that "Strings.resources" is properly embedded or linked to the assembly "App_Web_oplm6m_7" at compile time, or that all required satellite assemblies are loadable and fully signed.


My resource file: Strings.en-US.resx, has been placed under the App_GlobalResources folder


Resource file calling code:

        ResourceManager m_ResourceManager = new ResourceManager ("Strings", Assembly.GetExecutingAssembly ());

        CultureInfo m_CultureInfo = new CultureInfo ("en-US");

        this.lblTop.Text = m_ResourceManager.GetString ("div_top", m_CultureInfo);


Please master click, thank you
Reply

Use magic Report

2

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-5-4 22:45:01
| Show all posts
ResourceManager m_ResourceManager = new ResourceManager ("Strings", Assembly.GetExecutingAssembly ());

Is this sentence wrong, is it necessary to add a namespace or something, but VS generates its own assembly, and cannot customize the namespace?

Please guide and die. . . Thank you
Reply

Use magic Report

0

Threads

17

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

Post time: 2020-5-6 23:00:01
| Show all posts
Such.
When the resource file is generated, the default access type is internal. In other words, it can only be accessed in the same assembly.
Therefore, if you access the resource file in the same assembly, for example, the file name is "Strings.en-US.resx", just write in the program
string s = Strings_en-US.div_top; // The automatically generated class of the resource file after compilation will replace "." in the file name with "_".
Reply

Use magic Report

0

Threads

11

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-5-8 22:15:01
| Show all posts
The Strings.resources property is embedded in the project. . Ok. .
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list