The Assembly System.Deployment is referenced by System.Windows.Forms

Hi.
I added System.Windows.Forms in visual studio to my code. also i copied System.Windows.Forms.dll file from “C:\Windows\Microsoft.NET\Framework\v2.0.50727” to unity assets forlder.
Also i added using System.Windows.Forms; in my script.
Also in player settings, i changed API Compatibility level to .Net 2.0.
Also i cleaned windows temp folder.

But during build the game, it give me below error:

Note: I used Unity 5.5.3f1.

dose someone know how can fix this problem?

Thanks.

Pretty self-explanatory- you can’t use .NET’s System.Windows.Forms without System.Deployment, because some classes in the former rely on the latter.

You can try copying over the System.Deployment DLL from the same place that you got System.Windows.Forms, but something tells me it’s not going to be that easy. Unity doesn’t use .NET, it uses Mono, which is why most libraries that were made for .NET won’t work unless specifically compiled for Unity. Even though things more or less line up between .NET and Mono in the long run, there’s very often a gap in some features until later versions of Mono, and that gap is killer when you’re limited to such an old version for Unity.

“Try it and see” is all I can say. I doubt the .NET versions will work (even if they do in the editor, they’ll almost definitely fail in builds), but there are Mono assemblies. I think there’s a copy of the Mono WinForms that’s buried down in the Unity installation directories even.

Thanks @DonLoquacious .

Now i can build my project. :slight_smile:

Don’t copy win libs. Add references.