My .NET app runs as a plugin to a C++ MFC desktop app which provides a .NET SDK. The main app is in charge of loading .NET before it loads any plugins. I’m compiling my project against .NET 3.5, and the following test code works just fine:
MainApp.WriteLine("MyPlugin running on .NET {0}.{1}", _
System.Environment.Version.Major, _
System.Environment.Version.Minor)
Dim data As Int32() = New Int32() {1, 1, 1, 1, 4, 4, 4, 4, 12, 12, 12, 12}
For Each distinctValue As Int32 In data.Distinct()
MainApp.Write(distinctValue.ToString() & ", ")
Next
This is Linq code which should only run on .NET 3.5 right? However when it prints the version message it claims that “MyPlugin running on .NET 2.0”
Why/How is this working and can I rely on it to always work, provided .NET 3.5 has been installed?
At a guess, it is reporting the core version of .NET, which is 2.0. This was not updated unti lversion 4.0, because the core code is the same.