1

I am trying to compile and run code for a VNC Server on my RPi running Win10.

I have a very basic Visual Studio Solution with a C# console application project and a class library DLL. Both are targeting any CPU. I want to utilize System.Drawing (Rectangle, Size, Bitmap and Graphics).

The server seems to run on the PC but not on the RPi. I have added a reference to System.Drawing in both the console application project and the DLL project. When I run the program on the RPi I get the following error when Rectangle is called from the DLL:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

What am I doing wrong? I can make the call to System.Drawing.Rectangle in main() but not from the DLL.

2

Visual Studio is notorious for cryptic error message...

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

But in this case its pretty simple, System.IO.FileNotFoundException

You may need to go the refrences you added, right click on them and set the Copy Local to True. This will then copy and references on your Dev machine, to /bin when you publish the code.

You can also, just manually add the DLL to the BIN, since that is the first place .NET looks, then it tries GAC and other places.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.