We have old project, which back end written in .NET Core 2.2 and front in .NET Framework 4.0 (WPF), so i want to create and use common library for .Net Framework 4.0 project and for .Net Core 2.2 project. Is it possible what i use .NET Standard for this? Because in documentation (https://learn.microsoft.com/en-us/dotnet/standard/net-standard) written, minimum version of .NET Standard is .NET Standard 1.0 and supports .NET Framework 4.5. How i can solve this problem?
Asked
Active
Viewed 1,072 times
0
-
8No: like you said, .NET Framework 4.0 doesn't support any version of .NET Standard. You can write a project which is *multi-targetted* -- create a ".NET Core" project (with an SDK-style csproj), and change the `
` element to ` – canton7 Jun 28 '21 at 09:22netcoreapp2.2;net4.0 `. This will then compile to 2 binaries, one which targets .NET Core 2.2 and one which targets .NET 4.0 -
2You could either: a) update to a newer verison of the framework and then use .NET Standard, or b) created a ["shared library"](https://stackoverflow.com/questions/30634753/what-is-the-difference-between-a-shared-project-and-a-class-library-in-visual-st) (not a class library) and include it in corresponding .NET Framework and .NET Core (or .NET Standard) DLLs. – ProgrammingLlama Jun 28 '21 at 09:22
-
4That said, **upgrade**. .NET Core 2.2 reached EOL at the end of 2019 and no longer receives security updates. .NET Framework 4.0 reached EOL in 2016, and doesn't receive security updates either. You **need** to get yourself onto something newer and supported. – canton7 Jun 28 '21 at 09:23
-
we cannot change freamwork target, becouse this project running old devices which installed Windows XP – Mansur Kurtov Jun 28 '21 at 09:25
-
1Agreed - both of those frameworks are no longer supported and do not receive security upgrades anymore so are vulnerable to various CVEs. You should prioritise upgrading them to supported versions. – Martin Costello Jun 28 '21 at 09:25
-
1(And neither is Windows XP supported anymore) – Martin Costello Jun 28 '21 at 09:25
-
XP doesn't receive security updates either: you can pretty much guarantee that there are exploits being used in the wild, and nobody cares about patching them – canton7 Jun 28 '21 at 09:26
-
3XP stopped being supported 8 years ago. It sounds like your entire environment is hugely overdue an upgrade. That's the root of your problems. – ADyson Jun 28 '21 at 09:27
-
2i really hope those systems do _not_ have any network access whatsoever – Franz Gleichmann Jun 28 '21 at 09:44
-
1Microsoft with old versions of Net you had to install all previous versions like 1.0,2.0,3.0,3.5, 4.0. Newer version of Net all the previous version of Net are in latest release. You can still Target older version of Net. You just have to make sure the build and deploy machines have same version of Net or Publish and install app. No need to create different libraries. – jdweng Jun 28 '21 at 11:07