MathGroup Archive 2011

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

Search the Archive

Re: Problems with NETLink C#

  • To: mathgroup at
  • Subject: [mg120757] Re: Problems with NETLink C#
  • From: Todd Gayley <tgayley at>
  • Date: Tue, 9 Aug 2011 07:19:12 -0400 (EDT)
  • Delivered-to:
  • References: <>

At 03:21 AM 8/8/2011, tarpanelli at wrote:
>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:
>but when I try to load the assembly
>LoadNETAssembly ["F:\\My\\Mathematica\\mLink\\mNETLink\\mNETLink\\bin\
>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.

You need to allow .NET/Link to run in the 4.0 version of .NET. To do 
this, edit the configuration file <mathematica 
dir>/SystemFiles/Links/NETLink/InstallableNET.exe.config. In that 
short file you will see one or more <supportedRuntime> lines. Add 
this one as the _first_ one in the set:

     <supportedRuntime version="v4.0" />

After this, your assembly will load properly.

Todd Gayley
Wolfram Research

  • Prev by Date: Re: Animation
  • Next by Date: Workbench not updated for version 8?
  • Previous by thread: Problems with NETLink C#
  • Next by thread: Re: Problems with NETLink C#