MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Problems with NETLink C#

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120745] Problems with NETLink C#
  • From: "tarpanelli at libero.it" <tarpanelli at libero.it>
  • Date: Mon, 8 Aug 2011 04:21:47 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Reply-to: "tarpanelli at libero.it" <tarpanelli at libero.it>

Hello,

I have Mathematica 7 and Visual Studio 2010 Professional edition. What I am 
trying to do is tho create a simple class in C# and use it in Mathematica.

In mathematica notebook I 've written the following code:
Needs["NETLink`"]
InstallNET[]

but when I try to load the assembly
LoadNETAssembly ["F:\\My\\Mathematica\\mLink\\mNETLink\\mNETLink\\bin\
\\Debug\\mNETLink.dll"]

I got this error

NET::netexcptn: A .NET exception occurred: System.BadImageFormatException: 
Could not load file or assembly 'file:///F:
\My\Mathematica\mLink\mNETLink\mNETLink\bin\Debug\mNETLink.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:///F:
\My\Mathematica\mLink\mNETLink\mNETLink\bin\Debug\mNETLink.dll'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String 
codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& 
stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, 
Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, 
Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, 
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean 
forIntrospection)
   at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, 
Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm 
hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Wolfram.NETLink.TypeLoader.LoadAssembly(String assemblyName)
   at Wolfram.NETLink.Internal.CallPacketHandler.loadAssembly(KernelLinkImpl 
ml)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value 
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure 
logging.
To turn this feature off, remove the registry value 
[HKLM\Software\Microsoft\Fusion!EnableLog].



  • Prev by Date: Random prices from FinancialData
  • Next by Date: Re: NMinimize eats all memory b/c of unnecessary symbolic work
  • Previous by thread: Re: Pattern in immediate definition
  • Next by thread: Re: Problems with NETLink C#