x


Replace Microsoft dll's with Mono dll's in Visual Studio?

I currently working on 2 Unity projects. For these two I'm writing a library to easily get login data from a server, dialog text from xml, etc. I build the dll right out of Visual Studio, so it's referencing microsofts system.dll, system.data.dll etc.

I have to be sure that the library works on Windows and Mac. Won't the microsoft dll's cause problems on Mac?

Does it make sense te remove all references to the microsoft .NET framework in my visual studio project and in stead replace them with the Mono.NET dll's? Or am I talking crazy here?

more ▼

asked Feb 19, 2010 at 12:56 PM

Frederik gravatar image

Frederik
41 3 2 5

(comments are locked)
10|3000 characters needed characters left

5 answers: sort voted first

Both can work fine. What you should make sure is that the functionality you use from the system libraries, is actually supported in the version of Mono that is shipped with Unity. Most stuff is supported, but there are some gaps in newer functionality (stuff like Linq, ParallelFX, etc).

The safest would be to just reference Mono's libraries (you can find them in the unity editor's install folder), as you would notice any types not being available.

Please note that "which version" you referenced, does not get remembered. When Unity or Visual Studio makes an assembly out of your sourcecode, that just says "Use System.dll". It does not specify a specific vendor, nor does it embed System.dll.

more ▼

answered Feb 22, 2010 at 10:28 AM

Lucas Meijer 1 gravatar image

Lucas Meijer 1 ♦♦
8.9k 29 55 102

I tried referencing the Mono .NET assemblies (Unity 3.0\Editor\Data\Mono\lib\mono\unity) from within my VS2010 project, but VS ignores the location. That is, it accepts the dll's as valid within the 'Add Reference' dialog, but if I look at the properties on each reference they still point to the standard .NET location (C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll). Any ideas how to actually compile against the Unity Mono assemblies?

Oct 28, 2010 at 08:31 AM Tyson.9
(comments are locked)
10|3000 characters needed characters left

I don't really know or have the experience, but I bet Microsoft DLL can cause problems on the Mac. No crazy talk there - if you can use Mono.NET rather than MS.NET I highly suggest you to do so. It is made for that purpose.

more ▼

answered Feb 19, 2010 at 06:27 PM

Cawas gravatar image

Cawas
2.3k 113 102 123

(comments are locked)
10|3000 characters needed characters left

Maybe anyone else encountered this problem too?

more ▼

answered Feb 22, 2010 at 09:28 AM

Frederik gravatar image

Frederik
41 3 2 5

(comments are locked)
10|3000 characters needed characters left

I have done some compiling of DLLs for use with Unity iPhone and the biggest problem I have found is making sure you are compiling against the correct version of mono and not attempting to use features which are not in the Unity version of mono.

I have compiled numerous DLLs using .NET 2.0 in VS and they work just fine on the Mac and iPhone; but there are certain features that .NET 2.0 supports which if you use will cause errors on the Unity side.

more ▼

answered Feb 23, 2010 at 12:45 AM

Shawn gravatar image

Shawn
343 15 11 21

(comments are locked)
10|3000 characters needed characters left

as lucas said you don't need to reference mono DLLs to make your library compatible with unity but it will help in visual studio because you can see what is available in mono or not. if you use vs 2008, choose .NET 2.0 as the target platform because newer features and even some of 2.0's features are not available in unity's mono version. there is an analyzer tool called MOMA that you can use to check if there is any errors available. it will tell you about methods that you used that they are not available in mono.

more info when you compile an assembly, the compiler will create CIL code from your code and store them in a PE (EXE) file. it also stores metadata and references names and ... there is no difference between compiling with mono or Microsoft's compilers or using Microsoft or mono libraries. the runtime that you use (mono/MS .NET) should have those libraries and methods that use use or should be able to execute those CIL instructions. most of the times the problem is about platform dipendent libraries that mono should implement for each platform. so you just need to make sure mono has the libraries that you use and also see if it supports those methods that you use or not.

more ▼

answered Feb 23, 2010 at 05:51 AM

Ashkan_gc gravatar image

Ashkan_gc
10.1k 76 91 160

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x373
x242
x101

asked: Feb 19, 2010 at 12:56 PM

Seen: 4845 times

Last Updated: Feb 19, 2010 at 12:56 PM