Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by tamirhusain · Feb 12, 2017 at 05:47 PM · dllmonocompilecommand-linemanaged

How do you compile a managed dll with mono/mcs targeting .net 2.0 or 3.5 for Unity?

I have been using mono/mcs to compile dynamically generated (Protocol Buffer) code into managed DLLs for use in Unity. As of Unity 5.5, it looks like it will no longer load DLLs compiled against the 4.0 framework (I believe it wants 2.0 or 3.5).

I have seen how to do this in MonoDevelop or Visual Studio, but I would like to do this on the command line because the protobuf code is dynamically generated so it makes it much easier to use a shell script to compile.

In the shell script we do something like this:

 mono --runtime=v2.0.50727 <stuff>
 mcs -langversion:ISO-2 -sdk:2 -r:$unityengine_dll -target:library -out:$output <stuff>

When we do this, we've always had warnings come up in the following form (which makes it look like the target runtime is not actually being set correctly). Even with these warnings, in Unity 5.4.x it would load the dll fine and compile. In Unity 5.5+ it doesn't seem to be able to load the dll and dies on compilation errors (where it doesn't find things which should be defined in the dll)

 WARNING: The runtime version supported by this application is unavailable.
 Using default runtime: v4.0.30319
 No framework specified; defaulting to 4.0.30319.42000

What do we need to change? I have been playing around with the --runtime, --langversion, and -sdk -lib options of mono/mcs to no avail. What should these be set to for compiling for unity? Have also tried using both a current up-to-date version of mono to compile and also the mono that comes with Unity, both have the same issue.

Environment: osx sierra 10.12.3, unity 5.5, mono 4.6.2.16

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by jerome-lacoste · Sep 06, 2017 at 04:30 PM

Did you manage to fix your issue? We are able to make editor plugins compiled as DLLs using the following call:

 mcs -r:#{reference_string} -target:library -sdk:2 -out:my.dll #{files}

Using Unity 5.6, and mcs from MonoBleedingEdge bundled with Unity.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Mono and missing types using external library 2 Answers

How the c/c++ code limit affects the Unity 3 Answers

Unity trying to build a referenced DLL 0 Answers

'EventSystems' does not exist in the namespace 'UnityEngine'... 1 Answer

Determine WHAT was just compiled........ 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges