6
  • 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 ?

4
  • 3
    Short 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. Commented Nov 5, 2018 at 13:49
  • 1
    The 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. Commented Nov 5, 2018 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. Commented Nov 5, 2018 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. Commented Jan 14, 2021 at 5:28

2 Answers 2

8

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.

Sign up to request clarification or add additional context in comments.

2 Comments

7min. after closing the question? How is this even possible?
@HimBromBeere - I was curious about that as well. Appears to be due to the grace period: meta.stackoverflow.com/questions/252711/…
0

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.