Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Using Mathematica 8, I can check the version of the .NET framework used by NETLink as follows:



As you can see, it is the old 2.0 framework. However, my machine has version 4.0 of the .NET framework installed. Is there a way to configure Mathematica to use the newer version?

share|improve this question

1 Answer 1

up vote 25 down vote accepted

UPDATE The following steps are no longer necessary if one is using Mathematica version 9 -- it comes preconfigured to use .NET 4.0.

NETLink uses an interlude .NET application to broker communication with the framework. The application is called InstallableNET.exe (InstallableNET32.exe on 32-bit systems) and can be found in this directory:

SystemOpen @
  FileNameJoin[{$InstallationDirectory, "SystemFiles", "Links", "NETLink"}]

The application will use the version of the .NET framework that is configured in its .config file. To make it use version 4.0, add a new line within the startup element:

<supportedRuntime version = "v4.0"/>

Versions are tried in the order that they appear in the file, so place the preferred version first. The updated InstallableNET.exe.config will look something like this:

<?xml version="1.0" encoding="utf-8" ?>
    <!-- The supportedRuntime lines control which version of the .NET Framework will
         be used when .NET/Link is launched with InstallNET[].
         .NET/Link requires at least .NET 2.0. If you have .NET 3.0 installed,
         it will be used (note that the 3.0 version is really just the 2.0
         version with some extra assemblies).
      <supportedRuntime version="v4.0" />
      <supportedRuntime version="v2.0.50727" />

Note: If you're using Mono instead of Microsoft's CLR, you'll have to delete the first few (invisible) bytes from the XML file due to a Mono bug. One way to do this would be to tell your text editor to save the XML file as ASCII instead of Unicode. Another way would be to copy and paste the body of the file into a new file and then copy the new file over the previous InstallableNET.exe.config file.

share|improve this answer
Interestingly, having trouble getting this to work with Mono 2.10.8, despite that it's supposed to. Will report back in once I've got this fixed up. –  sblom Feb 18 '12 at 18:45
@sblom I haven't used Mono, but I have a guess anyway: perhaps Mono does not yet support the new partial version matching feature that was introduced in MS.NET v4 -- does a complete version specification work in place of the "v4.0"? –  WReach Feb 18 '12 at 18:51
Okay--got to the bottom of this. For some reason, Mono isn't reading an InstallableNET.exe.config that begins with a Unicode BOM. Once I deleted the BOM (which is redundant with the encoding="utf-8" part anyway), Mono began matching Microsoft's behavior here. –  sblom Feb 20 '12 at 21:23
Great answer! I was able to load .NET 4.0.30319.269 from Mathematica 8 –  Tomislav Topic Aug 19 '12 at 12:59
@sblom Thanks, this is extremely useful info about the BOM problem. I've just committed the fix to InstallableNET.exe.config, so this won't be an issue for future releases of Mathematica. –  Todd Gayley Dec 10 '12 at 21:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.