Forum Xamarin.Forms

Error: ResXFileCodeGenerator can only be used with .NET projects

Hello,

I've been trying to add internationalization to my Xamarin.Forms project I just started. I set up a few ContentPages and some of them currently have a few strings I need to show in different languages (i.e. english, spanish and russian). I've followed the steps to create the RESX file found in this Guide, but once I created the RESX file called AppResources.resx, I get an error message who says: Error: ResXFileCodeGenerator can only be used with .NET projects. I added the file to the root of the Xamarin.Forms common code project but it doesn't seem to be able to generate the AppResources.Designer.cs. Also, in the Tool Output, I get this message:

Running generator 'ResXFileCodeGenerator' on file '/Users/Username/Dev/AppProject/AppProject/AppResources.resx'...

Errors in file generation.

Also, once I create the resx file, I got not a blank file, but instead, a file with the following code (I don't know if that's normal or not):

<?xml version="1.0" encoding="utf-8"?>
<root>
    <resheader name="resmimetype">
        <value>text/microsoft-resx</value>
    </resheader>
    <resheader name="version">
        <value>2.0</value>
    </resheader>
    <resheader name="reader">
        <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    </resheader>
    <resheader name="writer">
        <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    </resheader>
</root>

What can I do to get a localizable app? I don't have a Windows computer to create the files there (it would be a waste of time the change just to get the localization done) and I've seen some others complaining about the same thing, so it might be possible this is a bug.

Any ideas?

Best Answer

Answers

  • AuriAuri USMember ✭✭

    Same problem here. This used to work, and now it doesn't. I've complained for months and they still haven't fixed it.

    XAMARIN, ARE YOU LISTENING?

    https://bugzilla.xamarin.com/show_bug.cgi?id=30175

  • PatrickDappollonioVegaPatrickDappollonioVega CLMember, Beta

    That should be in bold in the documentation. We invested a large amount of time in order to do a proper mobile application and now we face the problem whether start over or make our own translation solution.

  • rudyrykrudyryk RUMember ✭✭✭
    edited March 2016

    I've found an elegant workaround - It's easy to create portable project within solution and then just add reference to it.

    So, I'm adding *.resx files to portable project, also it's convenient to use PublicResXFileCodeGenerator as build tool - can be specified via right click on resource file -> Properties -> Custom tool

Sign In or Register to comment.