简体   繁体   中英

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?

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM