| |

VerySource

 Forgot password?
 Register
Search
View: 891|Reply: 7

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 16:00: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);






. . .

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

Is this sentence wrong, is it necessary to add a namespace or something, but vs2015 all generate assemblies by themselves, can not customize the namespace ah

Please guide, anxious. . . Thank you
Reply

Use magic Report

0

Threads

32

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

Post time: 2020-5-6 11:30:01
| Show all posts
Note the namespace, ResourceManager m_ResourceManager = new ResourceManager ("xxx.Strings", Assembly.GetExecutingAssembly ());
Others may have problems.
Reply

Use magic Report

0

Threads

16

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-5-7 19:30:02
| Show all posts
The Strings.en-US file is customized by you? Should it be under App_GlobalResources?
And did you copy it directly? Try adding existing items in the project and add resource files
Reply

Use magic Report

2

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-5-8 15:00:01
| Show all posts
xxx.Strings

What should this xxx be? 》

Is it App_Web_oplm6m_7 in my program?
Reply

Use magic Report

0

Threads

32

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

Post time: 2020-5-9 13:30:01
| Show all posts
Asp.net use GetGlobalResourceObject
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-5-11 17:45:01
| Show all posts
xxx should refer to the name of your project
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-16 22:15:01
| Show all posts
It's easy to rename it like this
CultureInfo m_CultureInfo = new CultureInfo("en-US");
ResourceManager rm = ResourceManager.CreateFileBasedResourceManager("Strings.en-US", ".", null);
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-16 22:30:01
| Show all posts
1. Pay attention to the namespace; 2 file attributes have an item to be changed to an embedded resource
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