Targeting multiple .net framework versions

Suppose I have some code that theoretically compiles against any version of a .net structure. Think "Hello World" if you want.

If I really compile the code, I get an executable that works with one specific version.

Is there a way to organize things so that the compiled exe just works against any version that it finds? I strongly suspect that the answer is no, but I would be happy if I were wrong ...


Edit: Okay, I'll go to the footsteps of our stairs. I had no idea that later frameworks would happily run exe compiled in earlier versions. Thanks for all the answers!

+4
source share
7

, , , exe.

+6

ScuttGu Multi-Targeting VS 2008

, VS 2008, , "Multi-Targeting" - , Visual Studio .NET Framework Visual Studio .NET Framework.

, VS 2008, .NET. - IDE . , , , , , - , , , , .NET Framework , .

VS2008 .NET 2.0, .NET 2.0, 3.0, 3.5

+3

, -, 1.0, 1.1 2. Somthing, 1.1, 2... ..

0

, @John Boker , .Net. .Net 1.1, .Net 2.0 .

, .

0

2005 2008 , ( CLR 2.0)

2003 .. CLR 1.1

#if (DOTNET35) , , ... .

0

, AFAIK, .NET( 1.x) -. # - , # 2.0. , , , # 3.0 3.5 DLL. .NET 2.0, .

, : (

0

.NET, , , .NET 3.5 SP1. (277 .) , ( .NET).

For more information and general tips on creating a small .NET installation, see this great Scott Hanselman blog post .

0
source

Source: https://habr.com/ru/post/1696678/


All Articles