Adam Rodger
Adam Rodger

Reputation: 3562

VS2010 Sharing Projects Between .Net Framework Versions

I have 2 Visual Studio 2010 solutions and I need to share a project between them. However, one of the solutions needs to build against .Net 3.5 and the other against 4.0.

If I change the Targeted Framework in one of the solutions, obviously this updates the project in the other and I can no longer compile the solution. Is there a way I can set the project to compile against different versions depending on which solution I'm using?

Upvotes: 3

Views: 160

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1500385

A solution doesn't build against a particular framework version - a project does. So it sounds like you should make your shared project target .NET 3.5, and you can still add a reference to this from a 4.0 project in the solution which requires that. So you'll have:

Application1 (3.5)      Application2 (4.0)
      \                    /
       \                  /
        \                /
         \              /
       Class library (3.5)

Upvotes: 4

Related Questions