As some of you may know, Microsoft has announced the final ship date for the whole .NET 2.0 kit (Visual Studio 2005, SQL Server 2005, etc) as November 7th. In addition, there have been some posts on devzone regarding LabVIEW hanging if the .NET 2.0 beta is installed. So, I thought I'd take a moment and cover the state of the union for LabVIEW and the next release of .NET.
LabVIEW 7.x
Unfortunately, as some people have discovered, LabVIEW 7 is not compatible with .NET 2.0. This has to do with the fact that Microsoft has completely redesigned the way the framework is installed (specifically the GAC) and this has broken the code that provides you with the list of installed assemblies. There is currently no workaround for this problem other than to not install .NET 2.0.
However, I'm working on a patch to
LV 7.1.1 that'll fix this problem. If you need this patch when it becomes available, please let me know (either post a comment or shoot me an email to
bloggingbrian@gmail.com). Once the patch is ready, it'll behave as described in Constellation below.
Note that this is a patch to LV 7.1.1 only (which is a free upgrade available to 7.1 users). If you have an earlier version you must first upgrade or wait for the Constellation release.
Constellation
As you might expect, supporting .NET 2.0 is a requirement for Constellation and so you can have either or both .NET 1.1 and 2.0 installed. However, this raises an interesting question of which one you get if both are installed. So, here you go...
LabVIEW uses the C++ .NET feature of IJW ("it just works" - we didn't come up with that, it's classic MS tech-marketing) to bring up the .NET runtime (a.k.a the CLR) and talk back and forth between the LabVIEW native code and the LabVIEW .NET code.
Because of that, the version of the CLR that executes under LV is always the most recent CLR installed on your machine. You can read
this article to get the complete details - see the
Application Load Mechanisms and Possible Issues section. We are the third row in the table.
Picking the .NET Framework
In general, this should not matter to most LV .NET users. Running under the 2.0 CLR is pretty much like running under the 1.1 CLR so your application should not care. However, there are some breaking changes between 1.1 and 2.0 that could cause you some problems depending on what parts of .NET you are using in your application. Again,
the article goes into the full details on that.
So, what happens if you absolutely need to run with the 1.1 CLR? Well, Microsoft has provided a configuration setting that forces a native application like LabVIEW to load a specified version of the CLR. For the LV development environment, you need to create a file called LabVIEW.exe.config (capitalization is optional) in the same directory as the EXE itself. Put the following into the file:
<configuration>
<startup>
<requiredRuntime version="v1.1.4322"/>
</startup>
</configuration>
Now LabVIEW is going to run with the 1.1 version of .NET even if .NET 2.0 is installed. Obviously, you'd better have installed 1.1 :)
What about built applications? The same general rule applies - you need the
requiredRuntime key put into your application's configuration file. See this
previous post about how to create .NET configuration files for your built application.
What if your built component is a DLL instead of an EXE? Well, that gets a bit more complicated. The short answer is that the EXE that is loading your DLL must have the above configuration file.
The longer answer: The requiredRuntime key must be loaded before the CLR version is picked. Unfortunately, the DLL's configuration file isn't processed until after the CLR is loaded. This is because LV puts the configuration file into the AppDomain for you - .NET doesn't support DLL-level config files. But by this point the CLR is already up and running so....
Longer answer addendum: Another point to consider is that the CLR is loaded by the first part of any application to request .NET - you only get one CLR per process. Therefore, you could consider two LV DLLs, one that wants 1.1 and one that wants 2.0. Well, that's going to be a problem if the DLL configuration file picked the CLR. Which CLR you got would depend on the load order. Therefore, the application is always the one that picks the CLR version.
Again - this is only a problem IF you care which version of the CLR is loaded. Almost every application out there should not care. Almost... :)