3

I have an assembly written in C # compiled with version 3.5 that uses WCF. This library must be used by another application written in vb.net an outside firm that compiled with version 2.0 .

Is it possible ?

Lucas B
  • 11,793
  • 5
  • 37
  • 50

2 Answers2

5

No, that's not possible, but not because of the framework difference. It's not possible because your client doesn't have the assemblies necessary for WCF.

Actually, .NET 2.0 and .NET 3.5 use the same CLR. If you compile code for .NET 3.5, but don't use any of the new assemblies, then it should be possible for that code to be consumed by a .NET 2.0 application. .NET 3.5 is just .NET 2.0 SP2 plus some new assemblies.

In fact, .NET 3.0 is .NET 2.0 SP1 plus some new assemblies. .NET 3.5 is .NET 2.0 SP2 plus .NET 3.0 SP1 plus more new assemblies. All three use the .NET 2.0 CLR.

.NET 4.0 uses a new CLR and is a new release. .NET 4.0 code cannot run on a .NET 2.0 machine. However, there is a feature to permit .NET 2.0 and .NET 4.0 CLRs to run at the same time.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
  • I don't understand this, you're saying the .net 3.5 dll would run in a hosted .net 2.0 process, and thus fail to link in the WCF stuff? Why? Even if that were true, WCF would still run in the 2.0 CLR. – Blindy Mar 21 '12 at 16:20
  • 1
    WCF cannot run there because the assemblies don't exist. I'm saying that one can create a program targeted at the .NET 3.5 framework and, if you don't use any of the new assemblies, that program will run on a system which has only .NET 2.0 SP2 installed. – John Saunders Mar 21 '12 at 16:26
  • Yea but I'm not sure that's what the OP is talking about. He's not talking about run-time restrictions, only about what frameworks the two programs are compiled against. I'm reading it as having both frameworks installed at once. – Blindy Mar 21 '12 at 16:28
0

No, you cannot do it. But you can do one thing. You can give your other application the necessary dll needed to run WCF code and any other dll that you have used in your application. I am not sure about that but you can have a try.

Kishore Kumar
  • 12,675
  • 27
  • 97
  • 154