Xaisoft
Xaisoft

Reputation: 46591

Can I have a 4.0 NET Project in a 2.0 NET Solution?

I have a solution with a bunch of 2.0 vb library projects and I want to add a 4.0 c# library project, so I can reference one of the vb projects in my c# project. Is this possible?

Upvotes: 0

Views: 152

Answers (2)

John Bledsoe
John Bledsoe

Reputation: 17642

I believe this is possible. Note that when your 2.0 VB library is being called by your 4.0 C# library project, then it will actually run under the 4.0 framework. (This assumes that the host application is compiled to run under the 4.0 framework as well.)

This shouldn't cause any issues but you should be aware of it. Before SP1, All Visual Studio Test Projects ran under the 4.0 framework, including those that referenced 2.0 assemblies and it worked all* the time.

*"all" simply means that I can't remember a time that it broke, but that doesn't mean it didn't :-)

Upvotes: 1

Jon Skeet
Jon Skeet

Reputation: 1500225

It depends what you mean by "2.0". If you mean they're projects targeting .NET 2.0, that's absolutely fine. If they're Visual Studio 2005 project files, it'll be slightly more awkward. You'll need to upgrade the solution file in order to use it from Visual Studio 2010, at which point it won't load in VS2005. I've had some success in using multiple solution files, one for each version of Visual Studio, and upgrading the project files. Earlier versions of Visual Studio will give a warning that they don't understand the later tools version, but they'll still work so long as you don't use any of the newer features.

Upvotes: 1

Related Questions