Embedding files in ResX file in Rider

Answered

I have several test files embedded as resource. I creates a project in MSVS and it looks like:

 

<data name="RequestStatusUpdateMessage" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\RequestStatusUpdateMessage.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="RequestMessageIE" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\RequestMessageIE.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="RequestMessageLE" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\RequestMessageLE.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>

When I run it in VS I get file content as string, but when I run it in rider, I get "Resources\RequestMessageLE.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8" which is obviosly not what I need.

 

How could it be fixed?

10 comments
Comment actions Permalink

Hello Alex,

Could you please provide a working repro?

0
Comment actions Permalink

I have the same experience. In Visual Studio simply add a new resource file, and embed a File into that resource file. Rider does not appear to support resource files, forcing me to go back to Visual Studio.

0
Comment actions Permalink

Got the same problem, is there any news on this?

0
Comment actions Permalink

Folks,

Unfortunately, we didn't manage to reproduce the issue. We'd be really grateful if someone could create a repro project and attach in to a new YouTrack issue or Support Request.

For example, with these steps everything works fine:

1. Create new non-Core WinForms project

2. Add a resource file to it

3. Embed a txt file to it with some random content, e.g. "My text"

4. Create a Text Box on Form1 and set its text to the content of your text file

In resource file:

<data name="TextFile1" type="System.Resources.ResXFileRef, System.Windows.Forms">
  <value>Resources\TextFile1.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;windows-1250</value>
</data>

In Form1.cs file:

this.textBox1.Text = Resource1.TextFile1;

Result after running in Rider 2020.3 EAP 6:

 

0
Comment actions Permalink

Just tried to reproduce the issue with exact project that caused the original error: problem solved, I can see proper results. Version 2020.2.4

I think it was solved somewhere midway. Thanks for work!

0
Comment actions Permalink

Alex,

Great! Thank you for verifying it

0
Comment actions Permalink

Hmmm, now when you replied I recalled that I had this issue on Mac. Did you test it on Windows? If so then could you be so kind to re-examine it on Mac or maybe Linux?

 

0
Comment actions Permalink

Hi Alex,

We've just tried the same scenario on Mac, and it works fine. Did you test your project on VS for Mac? Perhaps the issue is Mac-specific, and has nothing to do with Rider?

0
Comment actions Permalink

Hmm. Thanks for reply.

I think it may be closed until anyone can provide a link with repository that allows to reproduce the issue. Although I doubt it will happen: feature works just fine.

It could be bug in early netcore SDKs, which is also unrelated to Rider.

0
Comment actions Permalink

Agreed. Anyway, thanks for raising the issue.

Have a nice day!

0

Please sign in to leave a comment.