System.Windows.Forms.dll assembly is referenced by user code warning - can't find src

Hello,

I’m getting this warning message that I would like to get rid of:

While it is true I tried using System.Windows.Forms; it has been commented out since. Searching entire solution for “forms” in mono finds nothing relevant. I tried removing the “using” line instead of just commenting it out but it didn’t help. Another possibility I considered was that it’s referenced in a DLL. However I tried removing only DLL (uLink) from project and that didn’t help either.
In short I am out of ideas where this alleged reference resides.

Is this partly of your unity project or a.net DLL you are building for unity? If it’s a DLL then its probably in the project references.

It’s a Unity project

EDIT:
Is it possible that it’s some kind of a build cache thingy? Is there a forced full rebuild option of some kind available?

EDIT:
As suggested here I deleted content of Unity\Editor\Temp, delted previous build, reimported all but non of that helped with the warning.

EDIT:
I only get the warning when doing build but not when running in editor.

I’m having exactly the same problem… Did you find any solutions ?

I’m not using System.Windows.Forms at all but the warnings are there even if I put all my code in commentary. They only show up after the build and I have no problem running my application in the unity editor.

Try changing your build settings (Api compatibility level) so it uses .Net instead of .Net subset which it uses by default.

I’ve already done that but it doesn’t change anything.

Do you have any dll files in your project?

Yes, I have all the EmguCV library dll files and System.Drawing.dll that I need for EmguCV in my project. I have also another warning that concerns OnMouse_events but I don’t use that either…

It seems those dlls are not compatible with Unity.

Those dlls are working fine in the Unity editor and in PC/MAC/Linux Standalone but at the moment, my application doesn’t work on Android, probably because of the warnings I have.

Yes, that’s the point. It may work, but there is no full compatibility.

Emgu.CV.UI.dll (and ZedGraph.dll) seems to be the dll that was provoking the OnMouse_events warning.

But I think you were right for the System.Windows.Forms. It seems to be linked to the main dll of EmguCV.

Has Anyone solved this problem? I got this problem too… And I’ve spent 1 whole day solving it, still not get resolved.
My situation is:
I was trying to use System.Windows.Forms.dll in my Unity project, but I got this problem when I build it and want my app run on my Android Phone. So I noticed that I can not use it. So I delete this dll in my Plugin folder and comment out the using import in my code. But I still got this error.

Is there anyone know how to solve this ? In short I am really out of ideas

In short: System.Windows.Forms.dll is not completely compatible with Unity and that’s why it doesn’t work on all platforms.

Hi Dantus, thank you very much for you reply. I’ve found the reason is caused by my Android SDK version incompatible.
I’ve changed to another Android SDK. and now I can build and run perfectly on my Android Phone.
Hope this could help anyone who may encounter this problem too.

may i know what android sdk version is that?

Hey can you please tell me the android sdk version you have used ?

We know it doesn’t work on all platforms, but why is Unity saying it doesn’t work on the StandaloneWindows platform? It should work, and it does given the right import settings.

Having the same issue when trying to build to WebGL only (PC works fine, and Android too I believe), no idea where Windows.Forms was used in code, I never added it anywhere myself in code (so it must be in a DLL from some asset I’m using or something) and am having trouble tracking it down. I wish the warning gave a clue to where it was.

1 Like

Hi guys,

I am new with Unity and I have a problem with this topic.
Last week I built and run an App for Augmented Reality with Unity + Vuforia without any problems and it works fine with the mobile device.
But this week I’ve tried to build and run a new App version with some design changes and this message appears when compiling.

“System.Windows.Forms.dll assembly is referenced by user code, but is not supported on Android platform. Various failures might follow.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)”

Unity builds the App but when I try to run it with the mobile device the camera doesn’t works. It shows a blue-brown background.
I’ve searched into forums and I am not able to find the solution.

3569184--287827--upload_2018-7-19_13-22-44.png

Could you help me please?
Thanks in advance!

1 Like