.NET Core 1.1 Resource File Issue
Delete any .resx files currently in your Resources
directory.
Now go to your Resources
directory and right click for Add > New Item
.
Choose Resource File
and enter in a file name down the bottom of the form. It's important you get the name right first time and don't rename. You can use something like Resource.resx
.
This very first Resource.resx
file should have its own designer class. It also needs all the keys and values for localization for your project so if you have an existing Resource.en.resx
you can copy and paste the values from that into this one.
If you need IStringLocalizer<Resource>
or, in other words, you need to reference the Resource
class somehow then you will need to go to Solution Explorer and left-click on the Resource.resx
. In the Properties box there is a field called "Custom Tool". If you want a publically accessible class to be generated from the resx you will need to change this from ResXFileCodeGenerator
to PublicResXFileCodeGenerator
.
Now you can add the individual Resource.ja.resx
, Resource.es.resx
files. These do not need to have a custom tool ResXFileCodeGenerator
run on them so you can remove that from the properties. This will fix your error message.
Simply unload the project and reload it, the errors will disappear.
- Right click project in Solution Explorer > Unload Project
- Right click project in Solution Explorer > Reload Project