Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I reference a .NET 4.5 project from a .NET 4.0 project?

For complicated reasons involving historical projects, we have a core project that is shared across many products. The issue is that we can't migrate the project to 4.5 because we have some products that must work on Windows XP. Is there any workaround so that I can reference a .NET 4.5 dll from that .NET 4.0 project?

I realize that we could branch the project, one for each .NET version, but that introduces a lot of maintenance overhead....

Any help would be great!

EDIT - To be clear, we would like it to reference a .NET 4.5 dll, but any of our products that run on Windows XP wouldn't execute anything from it, only our newer products would utilize its features.

like image 669
Luthian Avatar asked Feb 17 '23 04:02

Luthian


1 Answers

The issue is that we can't migrate the project to 4.5 because we have some products that must work on Windows XP.

If these products use the "core project", you'll need to leave it targeting .NET 4.0 or earlier. There is no way to use a .NET 4.5 assembly from any project on Windows XP.

If you need .NET 4.5 features, you'll need to either upgrade those projects, or maintain two versions.

like image 179
Reed Copsey Avatar answered Mar 19 '23 16:03

Reed Copsey