Mono take mscorlib.dll 2.0 instead of 4.0
Asked Answered
U

2

3

I am having a problem with an MONO application, I'm trying to compile the project (with MonoDevelop) so as to load the library run mscorlib.dll 4.0 instead of version 2.0. (I need System.Type.op_Equality method that is in version 4.0 but not in 2.0).

I've temporarily solved by making a link:

# cd /usr/lib/mono/2.0
# mv mscorlib.dll mscorlib.dll.bak
# ln ../4.0/mscorlib.dll mscorlib.dll

But of course this is not a valid solution.

Does anyone know how to MONO load mscorlib 4.0 instead of 2.0?

Thanks and sorry for my English

Unpractical answered 4/6, 2012 at 9:18 Comment(0)
U
3

Finaly I found a solution for this problem:

https://bugs.launchpad.net/ubuntu/+source/gtk-sharp2/+bug/884035/comments/14

Simply modify the "app.config" file and change the content for this:

<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0"/></startup></configuration>

Recompile the proyect and now work fine.

Unpractical answered 4/4, 2013 at 12:24 Comment(0)
P
1

Right-click the project -> open the Build/General page and make sure Target Framework is Mono / .NET 4.0:

enter image description here

Phore answered 4/6, 2012 at 9:31 Comment(17)
Thaks Rolf Bjarne, but now I have that configuration, and I'm still doing the same. jesusanchez.net/instantanea2.pngUnpractical
forgive my ignorance, but I do not know how to make monodevelop show me the buld output. Can you tell me how i show the output?Unpractical
@gokuhs: in the menu View -> Pads -> Error List. Now click the "Build Output" button and rebuild your project.Phore
Thanks for your help @rolf-bjarne-kvinge, this is the build output: (is in spanish sorry) pastebin.com/hhtT6qfJUnpractical
@gokuhs: that's doing the right thing, it's building a 4.0 executable. Exactly which problem are you having at runtime (i.e. how do you determine that you're running on a 2.0 runtime)?Phore
Thanks for the reply, I know because if I run the app without doing the procedure I describe above (create a link to overwrite the mscorlib.dll 2.0 and point to the mscorlib.dll 4.0) the application gives me the following exception:"Method not found: 'System.Type.op_Equality'." I got the idea to create the link after reading this thread: monotouch.2284126.n4.nabble.com/… (Now I realize that you too you remarked on it ;-) )Unpractical
Reading the excepcion I found this: Missing method System.Type::op_Equality(Type,Type) in assembly /usr/lib/mono/2.0/mscorlib.dll, referenced in assembly /usr/lib/mono/gac/gtk-sharp/2.12.0.0__35e10195dab3c99f/gtk-sharp.dllUnpractical
try running this from a command line and pastebin the output: MONO_LOG_LEVEL=debug MONO_LOG_MASK=asm mono --debug yourapp.exe (all in one line)Phore
Wow Thanks for the command, I will be useful later! :-) this is de output: pastebin.com/tjUjGEr2Unpractical
This is very strange. Can you try these too: monodis --assemblyref yourapp.exe and mono --version?Phore
This is stranger and stranger, there is no reason mono should load the 2.0 corlib, yet it does :| What does this program print: pastebin.com/hRKWcBii if you compile and run it like this: dmcs test.cs && mono test.exe?Phore
mmmmm your example seems ok: pastebin.com/adbxDqaj Is it possible monodevelop are using the copiler of Mono 2.0 (gmcs) instead of 4.0 (dmcs)? EDIT: I write your line in my Main function, this is the output: pastebin.com/XJnMeivmUnpractical
No, MonoDevelop is using dmcs (as you showed yourself here: pastebin.com/hhtT6qfJ). However it does look like you have an extra mscorlib.dll in your output directory, can you remove that file and run again from the command line (so MonoDevelop doesn't copy the file back again)?Phore
I'm afraid I have the same problem: pastebin.com/6PbQRRyA, Could it be that the project initially was a Visual Studio .NET Proyect? If nothing works, I will try to reinstall mono (purging the packages)Unpractical
I don't believe it's a problem with mono, but instead with your project. What happens if you create a new project from scratch/template? Does that work as expected?Phore
Mmmm, yes if I create a new project it work fine, now I will try to create a new project and move the code form the old proyect to the new project.Unpractical
I finished copying the project to a new one, and now work properly, thanks for your help!Unpractical

© 2022 - 2024 — McMap. All rights reserved.