Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.Windows.Forms exception on windows build (exe) #71

Open
hippogamesunity opened this issue Nov 25, 2019 · 6 comments
Open

System.Windows.Forms exception on windows build (exe) #71

hippogamesunity opened this issue Nov 25, 2019 · 6 comments

Comments

@hippogamesunity
Copy link

hippogamesunity commented Nov 25, 2019

ArgumentException: The Assembly System.Drawing is referenced by System.Windows.Forms ('Assets/StandaloneFileBrowser/Plugins/System.Windows.Forms.dll'). But the dll is not allowed to be included or could not be found.

A workaround suggested here doesn't work for me in Unity 2019.2.4

So I've made my own workaround and can suggest you to add it to the repo:

  • replace System.Windows.Forms (targeting .NET 3.5) to C:\Windows\Microsoft.NET\Framework\v4.0.30319 (targeting .NET 4)
  • add System.Deployment.dll (as required by System.Windows.Forms)
  • switch to Mono [!]
  • build
@hippogamesunity hippogamesunity changed the title System.Windows.Forms exception on build System.Windows.Forms exception on windows build (exe) Nov 25, 2019
@Hshan7
Copy link

Hshan7 commented Nov 30, 2019

It's works, thank very much. But after bulid the dialog can not show in program but only in the Unity editor. Have someone ever met the same problem?

@hippogamesunity
Copy link
Author

hippogamesunity commented Dec 1, 2019

@Hshan7 omg, you're right, I've forgot to test it outside of Unity. So the only solution I've found is targeting your project to .NET 3.5 and using original DLL. Hope @gkngkc will help us.

@hippogamesunity
Copy link
Author

@Hshan7 System.Windows.Forms (.NET 4.0) works with Mono Scripting Backend!

@Hshan7
Copy link

Hshan7 commented Dec 1, 2019

@Hshan7 System.Windows.Forms (.NET 4.0) works with Mono Scripting Backend!
I switch my api compatibility level to .NET 4.x in player settings and the dialog can show. And no need to replace the System.Windows.Forms.dll or add System.Deployment.dll. Thanks for your answer.

@veggiesaurus
Copy link

Hoping there's some way to get this to work with IL2CPP as well.

@kaninhot004
Copy link

Change Player Setting .NET to 4.0 can be solved this problem like @Hshan7 said.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants