You can use a config file to direct the runtime to use a particular version
of the framework.
The config file must be named the same as the dll or the exe, but with
..config at the end...
MyApp.exe.config
MyAppLib.dll.config
You can write the config file, if it does not already exist, in notepad, and
add it to the project.
Here is an example of a config file
<?xml version ="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v1.1.4322" />
</startup>
</configuration>
Just name the file as stated above, and use one of these files for each
project in the solution. Also...get the exact version number for 3.0 and
insert it in place of version="v1.1.4322" as shown above.
Caution: AT DESIGN TIME, when attempting to use a later version of the
framework using an older version of VB.net, your design-time views of forms
may not be available. To alleviate this, use the compatible framework that
your design environment was intended for. When you compile for runtime, you
can switch out the referenced assemblies and add the config file. (Actually,
I think you only have to switch one reference for each project, and the rest
happen automatically.)
This is a tricky proposition, because you are actually writing code as
though it will be compiled against the expected framework. I would only
suggest doing this if you have a distinct reason for doing so.
Recently, I needed the System.Net.Mail namespace instead of the
System.Web.Mail namespace due to an additional method that I needed. Except
when I was testing for that method, I still was running the compatible
framework. When compiling the release, I did the switch. (You need to be
sure the config file is properly directed, or only present when compiling to
the "mis-matched" framework).
You should do serious beta testing for compatibility issues.
By default, I think that the compiled exe and dll's, whatever framework they
are compiled to run under, will find the closest framework available on the
system they are running on (unless the config file provides distinct
direction).
http://msdn2.microsoft.com/en-us/library/aa720684(VS.71).aspx