In my .NET Core class library project, the resource file does not get updated when the resource file name contains a dot in it. For example, when I add Resources.en.resx
or Resources.es.resx
files in the .NET Core project, the custom tool is not able to generate or update the C# resource file. Here is error message:
Custom tool ResXFileCodeGenerator failed to produce an output for input file 'Resources.en.resx' but did not log a specific error.
If you know any workaround or any fix for it, please kindly point me to the right direction
Simply unload the project and reload it, the errors will disappear.
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.
I'm using VS2019 with .Net Standard 2.0 and still this error remain. I've try and try, ... deleting file, clean, rebuild. But still the error remain.
I've ended up to using ResXManager witch work fantastically well, it is available from the Visual Studio marketplace.
https://marketplace.visualstudio.com/items?itemName=TomEnglert.ResXManager
Thumb up for the ResXManager team!
Based on the answer of @David Rawson I have been able to solve the error by doing the following:
Resource file
that is mentioned in the error messageProperties window
)<reset to default>
That's it!
The error came up because I have changed the Access Modifier
of the resource file from no code generation to public while I was testing some stuff.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With