Search code examples
c#embedded-resourceproject-reference

System.Windows.Forms reference in Resources.resx


I have a class library project (.NET Framework 4.5.1) that compiles and works. When analyzing with ReSharper, it reported that the generated Resources.resx file references System.Windows.Forms, which isn't referenced in the project.

  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  <data name="MyResource" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>...</value>
  </data>
  • Why do I need Forms to embed a resource?
  • Is there any issue with not referencing Forms? (Again, the calling code works.)

Solution

  • You don't need Forms to embed a resource. Although the compiler uses the System.Resources.ResXFileRef that is located in System.Windows.Forms to embed your file into the dll. Just disable the warning.