- A project with C# 3.0 and .NET Framework 3.5 can use a dll with the most recent version of C# and .NET Framework ?
A project with C# 3.0 can use a dll with the most recent version of C# but similar .NET Framework version ?
A project with .NET Framework 3.5 can use a dll with the most recent version of .NET Framework but similar C# version ?

- 147,647
- 23
- 218
- 272

- 712
- 2
- 12
- 36
-
3Short answer: No. A project targeting .NET Framework version X can reference an assembly that is compiled against any .NET Framework version up until version X. – mm8 Nov 05 '18 at 13:49
-
1The C# language version number does not matter, its just an information for the compiler how to "understand" what you have written - once your code is compiled the only limit for reference is you can only reference framework version lower or identical to your project. – Rand Random Nov 05 '18 at 13:55
-
He obviously want to do it. This question smells X,Y problem. as @mm8 said, it's a short answer to say no. But it is possible to work around and use a higher framework version with lower one. Your question right now simply ask for if it's "directly" possible and that is obviously no. – Franck Nov 05 '18 at 13:57
-
Even if this were possible, the practical result would be that functionality based on higher versions of .NET would not work on systems where that prerequisite was been met. – Chiramisu Jan 14 '21 at 05:28
2 Answers
A project with C# 3.0 and .NET Framework 3.5 can use a dll with the most recent version of C# and .NET Framework ?
Short answer: No. A project targeting .NET Framework version 3.5 can reference an assembly that is compiled against any .NET Framework version up until version 3.5.
A project with C# 3.0 can use a dll with the most recent version of C# but similar .NET Framework version ?
Yes. The version of the programming language is only important at compile time. At runtime, it doesn't matter which version of C# the assmebly was implemented with.
A project with .NET Framework 3.5 can use a dll with the most recent version of .NET Framework but similar C# version ?
No. An assembly built against .NET Framework 3.5 can only reference assemblies built against .NET Framework 3.5 or earlier.

- 163,881
- 10
- 57
- 88
-
17min. after closing the question? How is this even possible? – MakePeaceGreatAgain Nov 05 '18 at 14:04
-
@HimBromBeere - I was curious about that as well. Appears to be due to the grace period: https://meta.stackoverflow.com/questions/252711/this-answer-was-posted-after-the-question-was-closed-how-is-that-possible – Broots Waymb Nov 05 '18 at 14:09
No you can't certainly and it's bound by the Target Framework you have choose. Even if you try to open that project/solution in a latest version of VS, VS will try migrating your solution to the latest framework

- 76,197
- 13
- 71
- 125