Will a windows application developed in .net 4 which references an assembly developed in .net 3.5, require both .net 4 and .net 3.5 to be installed for the application to run?
I suspect so, as is one of my observation. Also, it feels logical as both require different runtime for their execution.
[EDIT]
I'm enlightened :) So, here's my real question which has remained unanswered for a while here at SO. Would be glad if you guys can figure out the issue!
The application's app.config already has the following lines.
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
Im not sure you need to have 3.5 installed.. The .net 4.0 CLR is able to load assemblies written in .net 2.0 and up, and it seems unlikely that they'd be running diffrent versions of the CLR since .net4 and 2.0 assemblies can call each other without any interop.
What i do know is that if your executable is a .net 4.0 assembly, you might have to modify your app.config for it to load .net 2.0 assemblies in some cases. This is because the security model changed from CAS in .net 2.0 to a simplified system in 4.0
This to me would seem like further indication that the .net 2.0 clr is in fact not used when loading a .net 2.0 assembly into a .net 4.0 process.
(.net 2.0 and 4.0 referes to the common language runtime version, 2.0, 3.0 and 3.5 all use the 2.0 version of the CLR)
-edit-
According to this thread, .net 3.5 should not be needed to load a 3.5 assembly if the process is 4.0.
-edit2-
Here is how you'd modify your app.config to let a .net 4.0 executable load 2.0 assemblies in all scenarios (such as running of a network drive)
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
No, you won't need .NET 3.5 to be installed. Assuming you're doing nothing particularly funky, all assemblies will be loaded into the same CLR, and so the .NET 3.5 assembly will end up using the .NET 4 implementation of all the classes it uses.
As aL3891 mentioned, the security system has changed a little over time, but if it's a "simple" class library which doesn't use CAS, it should be fine without any special work. Of course, it would be best to test all of this before it ends up on a customer's machine :)
Correction: I had an assembly that required both .NET 4.0 and .NET 3.5 to be installed; but according to research, this is not typical and normally not the case.
In my case, adding the following lines of code to my app.config from aL3891's answer above removed the dependency on .NET 3.5 for me.
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>