resharperassembliessystem.drawingresxpublickeytoken

Why does R# tell me "Cannot resolve assembly System.Drawing" when I am referencing System.Drawing?


When I run "Inspect > Code Issues in Solution", R# tells me "Cannot resolve assembly System.Drawing" and points to this line of xml in a *.resx file:

<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

I looked at my System.Drawing assembly in my project's list of References. It is version 3.5.0.0, not 2.0.0.0, so I changed the version number in the xaml in the .resx file from 2.0 to 3.5. That still elicited the same warning from R#, though.

So then I thought maybe it was the PublicKeyToken that was the culprit; so I changed that value from "b03f5f7f11d50a3a" to "969db8053d3322ac" (as found here); but then the project wouldn't even build; I got:

Invalid Resx file. The located assembly's manifest definition does not match the assembly reference.

Although these "issues" exist, the app seems to be working okay - the image that follows the assembly alias:

<data name="pictureBox1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
    <value>
        blee blah bloo
</value>
  </data>

...displays fine.

Still, when R# raises its finger, it makes me nervous; how can I rectify this flubup?

NOTE: This is a Visual Studio 2008 Windows CE/Compact Framework app.


Solution

  • I had a similar problem in the resx file in one of my C# projects:

    enter image description here

    Once I installed the relevant reference (System.Windows.Forms etc) - for that project - that particular resharper issue went away: