1

I want to write an application that run on windows 7 , 8 , 8.1 and 10 so I targeted 3.5 .NET framework on visual studio ( application name > build > Target framework > Select ".NET Framework 3.5" ) which as far as I know it's the version that windows 7 is shipped with by default (correct me if not) .

after that I added 2 entries to app.config file in visual studio so the whole file became like the following :

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0"/>
    <supportedRuntime version="v2.0.50727"/>
  </startup>
</configuration>

now is this enough to have my application working on windows 7 and later ? if not enough , how I can achieve this ? I viewed all stack overflow "Similar Questions" but nothing helped

EDIT : I don't want the user to be prompted with .NET download dialog if the .Net framework not found.

  • I'd point out: Supporting Windows 7 and the framework it shipped with almost 8 years ago is a very different distinction... Are you expecting important batches of your users to never upgrade or disable upgrades? – Austin T French Jun 26 '17 at 19:08
  • I'm expecting the worst case happens here ... a user with fresh-installed windows 7 , or any other fresh-installed windows versions – mahmoud nezar sarhan Jun 26 '17 at 19:22
  • .NET v2 apps will run on machines that have .NET 3+ installed. But you need to target v2 for it to run on machines that only have v2 installed. – ps2goat Jun 26 '17 at 19:29
  • Have you considered packaging up the .NET runtime with your application and performing a silent install? https://stackoverflow.com/questions/10050160/packaging-a-net-application-so-it-will-run-on-a-computer-without-net – JasCav Jun 26 '17 at 19:31
  • @JasCav actually this is not an option I would go with – mahmoud nezar sarhan Jun 26 '17 at 19:56

1 Answers1

1

It should be enough to make your application run on any computer where either the .NET Framework 4 or the .NET Framework 3.5 is installed.

<supportedRuntime version="v4.0" /> make the application prefer .NET Framework 4.0 if it is installed and <supportedRuntime version="v2.0.50727" /> makes sure that you still support users with only .NET Framework 3.5 installed. You should change the order if you want the application to prefer 3.5:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <startup>
        <supportedRuntime version="v2.0.50727"/>
        <supportedRuntime version="v4.0"/>
    </startup>
</configuration>
mm8
  • 163,881
  • 10
  • 57
  • 88
  • version="v2.0.50727" includes .NET 2 , .NET 3 and .NET 3.5 and version="v4.0" includes .NET 4 up to .NET 4.7 so by those entries I covered windows 7 up to windows 10 ... is that correct ? – mahmoud nezar sarhan Jun 27 '17 at 00:43
  • Sort of. But you are not really covering "windows 7 up to windows 10" but rather the different versions of the .NET Framework that are installed on Windows. – mm8 Jun 27 '17 at 09:29