A) In Asp.net Core projects
This problem is a known bug in Asp.net Core
projects and access modifier is on public
by default and you can not change it. It will be solved by asp.net core team next updates but if you need internal
access modifier you can use my temporary solution:
- Add your all items by the resource designer in your
Resource.resx
and save it
- In the solution explorer expand the
Resource.resx
tree and open Resource.Designer.cs
- Replace all
public
strings in it with internal
and save it
Note: every time you save the Resource.resx
file you should do the step 3 again.
Finally you should have a Resource.Designer.cs
file with access modifiers like this:

Also check the namespace
in Resource.Designer.cs
file. it should be a appropriate namespace
. Sync with your project namespace
.
B) In Normal Asp.net projects
If you have not CustomTool
property in the Properties panel
for your resource (.resx
) file to change it to
PublicResXFileCodeGenerator
and solve the problem
Then you should change some settings in your project (.csproj
) file manually. It's so easy, just follow my instructions:
- Right click on your project in
solution explorer
and select Unload Project
- Right click again on it and select Edit .....csproj
- In the opened
.csproj
file, find the .resx
string, you will see a block of settings there. That is something like bellow codes.
- Change it to something like the following code (include
PublicResXFileCodeGenerator
):
.
<EmbeddedResource Include="MyResourceFile.resx">
<SubType>Designer</SubType>
<Generator>PublicResXFileCodeGenerator</Generator> <!--important line-->
<LastGenOutput>MyResourceFile.Designer.cs</LastGenOutput>
</EmbeddedResource>
- Save the edited
.csproj
file
- Right click again on your project in the
solution explorer
and select Reload project
- Now open your
.resx
file and enjoy ;)
Note: use your resource file name instead of MyResourceFile