.Net "Any infrastructure"

I built a program in C # .NET 2.0, which also works fine in frameworks 3.0 and 3.5.

But if the .NET Framework 4.0 is the only installed infrastructure, it does not work, it requires the user to install 2.0.

I found the following configuration on google:

<startup>
    <requiredRuntime safemode="true" imageVersion="v4.0.30319" version="v4.0.30319"/>
</startup>

After adding this to app.config, my program runs on the .NET Framework 4.0 without problems!

What I'm looking for is a .NET Any Framework configuration that runs my program under .NET 2.0, if installed, and also in .NET 4.0.

How to do it?

+3
source share
4 answers

Found it!

Here is the configuration for everyone who needs it:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <startup>
    <supportedRuntime version="v2.0.50727"/>
    <supportedRuntime version="v4.0.30319" sku=".NETFramework,Version=v4.0,Profile=Client" />
  </startup>
</configuration>
+2
source

. .NET 4 , .NET 2, 2 CLR. , , v4 CLR, . , , , , , .

, . .NET 2 ( Vista +). , , .

+3

, ​​ 4.0. .NET 2.0 Vista Win7, . XP, .NET. , ​​. - , .NET.

, , . , - , . XP, , . Setup.

Otherwise, your app.config is incorrect, <requiredRuntime>deprecated with .NET 1.0. The correct spell <requestedRuntime>and ask both 2.0.50727 and 4.0

+1
source

thing necessary to change the minimum requirements for the application.

move on to setting up the project to change the target structure to 2.0, and I think that it reproduces the same thing, even the user has 2.0 or 4.0 Net framework in their system

0
source

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


All Articles