Error loading .NET 4.0 assembly when running proxygen

275 views
Skip to first unread message

Pragna

unread,
May 9, 2011, 2:52:16 PM5/9/11
to jni4net
Context:
My dlls are compiled using .NET version 4.0.30319.1

Stack Trace:
System.BadImageFormatException: Could not load file or assembly
'file:///C:\Users\....dll' or one of its dependencies. This assembly
is built by a runtime newer than the currently loaded runtime and
cannot be
loaded.
File name: 'file:///C:\Users....dll'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark& stac
kMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName
assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark,
Boolean forIntrospection
)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at net.sf.jni4net.proxygen.model.Repository.LoadFile(String file)
at net.sf.jni4net.proxygen.model.Repository.LoadAssemblies()
at net.sf.jni4net.proxygen.model.Repository.Register()
at net.sf.jni4net.proxygen.Program.Work(String[] args)
at net.sf.jni4net.proxygen.Program.Main(String[] args)

Pavel Šavara

unread,
May 9, 2011, 3:00:09 PM5/9/11
to jni...@googlegroups.com
Well, I guess you just switched CLR version to 2.0.
You showed in last post that your C++ DLLs are compiled to CLR 2.0,
therefore you can't run it on CLR 4.0 ....
You have to choose your CLR version and compile all for it.

> --
> You received this message because you are subscribed to jni...@googlegroups.com
> http://groups.google.com/group/jni4net?hl=en-GB?hl=en-GB
> http://jni4net.sf.net/
>

Pragna

unread,
May 9, 2011, 4:02:35 PM5/9/11
to jni4net
I have recompiled all my dlls to .NET 4.0. I have .NET 4.0 installed
with Service Pack 1. I am wondering if my version of .NET is higher
than what proxygen needs ...
> >http://jni4net.sf.net/- Hide quoted text -
>
> - Show quoted text -

Pavel Šavara

unread,
May 9, 2011, 4:27:04 PM5/9/11
to jni...@googlegroups.com
Oh, i didn't realized you are talking about proxygen.
Create proxygen.exe.config with something like this and put it next to exe.

<configuration>
<startup>
<supportRuntime version="4.0"/>
</startup>
</configuration>

Pragna

unread,
May 9, 2011, 4:50:02 PM5/9/11
to jni4net
I'm getting the same exception.
> >> >http://jni4net.sf.net/-Hide quoted text -

Pavel Šavara

unread,
May 9, 2011, 4:57:58 PM5/9/11
to jni...@googlegroups.com
No other idea.

Pragna

unread,
May 9, 2011, 4:58:04 PM5/9/11
to jni4net
How can I pass proxygen a config file and the dll?
> > >> >http://jni4net.sf.net/-Hidequoted text -
>
> > >> - Show quoted text -
>
> > > --
> > > You received this message because you are subscribed to jni...@googlegroups.com
> > >http://groups.google.com/group/jni4net?hl=en-GB?hl=en-GB
> > >http://jni4net.sf.net/-Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -

Pavel Šavara

unread,
May 9, 2011, 9:56:38 PM5/9/11
to jni...@googlegroups.com
Yes please, to my email address. Not to the group. Thx.

Pavel Šavara

unread,
May 9, 2011, 10:01:30 PM5/9/11
to jni...@googlegroups.com
Sorry, ignore prev email.

You could add assembly reference to config file. Like this

<AssemblyReference Assembly="target/circular.dll"/>

http://code.google.com/p/jni4net/source/browse/trunk/content/samples/circular/circular7/circular6.proxygen.xml

Reply all
Reply to author
Forward
0 new messages