Global Resources from Class in App_Code

I moved one of my classes to the App_Code folder (and namespace), and inside this class I have a link to a global resource:

using Res = myProjectName.App_GlobalResources.Validation;

Before moving this class to the App_Code folder, everything worked fine. Now I get a runtime error stating that:

CS0122: 'myProjectName.App_GlobalResources.Validation' is inaccessible due to
its protection level

If I go into the constructor code for Validation.resx (Validation.designer.cs) and change it internal class Validationto public ( public class Validation), then it works fine.

Why can't I access this as usual from inside the App_Code folder?

Is this because the contents of App_Code and App_GlobalResources are dynamically compiled, and at runtime, App_Code is compiled first, and my Resal Resx has not been compiled yet?

Thanks for any answers.

+3
2

.

+2

"PublicResXFileCodeGenerator"

+1

Source: https://habr.com/ru/post/1726887/


All Articles