MathGroup Archive 2011

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

Search the Archive

Re: Problems with NETLink C#

  • To: mathgroup at
  • Subject: [mg120777] Re: Problems with NETLink C#
  • From: "Oleksandr Rasputinov" <oleksandr_rasputinov at>
  • Date: Tue, 9 Aug 2011 07:22:58 -0400 (EDT)
  • Delivered-to:
  • References: <j1o6lg$4jv$>

On Mon, 08 Aug 2011 09:27:28 +0100, tarpanelli at  
<tarpanelli at> wrote:

> 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.
>[extra messages removed]
> any suggestion?
> thanks

As I understand it, Mathematica 7 (and 8, for that matter) for Windows is  
compiled using Visual Studio 2005, so the most recent supported .Net  
runtime is version 2.0.

You might try recompiling .NET/Link from source using Visual Studio 2010  
if you want support for the newer .Net version 3.5 and 4.0 runtimes. I  
have not personally tried this, so I do not know how difficult it may be.

Alternatively, you can install the .Net version 3.5 runtime alongside  
Visual Studio 2010 and target version 2.0 per the instructions given at  
Assemblies compiled in this way will then be able to be loaded by  
..NET/Link as supplied with Mathematica.

  • Prev by Date: Re: Can a Locator be Made to Track a Curve?
  • Next by Date: Re: Random prices from FinancialData
  • Previous by thread: Re: Problems with NETLink C#
  • Next by thread: Textbook recommendation?