1

Can I add a 4.5 project inside a solution with only 4.0 projects?

Example:

-ProductSolution
   -Product.Domain.csproj (4.0)
   -Product.Web.csproj (4.0)
   -Product.WebApi.csproj (4.5)

I can't migrate my projects right now. And I want to add an Web Api and reference it to my Product.Domain project.

Thanks for any help.

wallybh
  • 934
  • 1
  • 11
  • 28

2 Answers2

1

You can't. A 4.0 project can't reference a 4.5 project so the end goal is unachievable.

Joshua
  • 40,822
  • 8
  • 72
  • 132
1

You can have projects with multiple .Net versions in a single solution under Visual Studio,

BUT, you can't refer a .Net framework 4.5 version project inside an older version's project.

.Net frameworks are not forward compatible.

So your project Product.WebApi.csproj (4.5) is based on 4.5, you can't add reference to it in Product.Domain.csproj (4.0)

Community
  • 1
  • 1
Habib
  • 219,104
  • 29
  • 407
  • 436