-2

I was able to run console application targeted to .net 4.7.2 on machine where .net 4.7.0 is installed.
Can I safely run .net 4.7.2 targeted application on machine which has .net 4.7.0 installed?

finch
  • 395
  • 1
  • 3
  • 7
  • That machine did not have 4.7 installed. Very few do, Windows Update delivers updates. If it is disabled then you'd [see this](https://stackoverflow.com/a/10033128/17034). Check for the installed version [like this](https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed). – Hans Passant Aug 10 '20 at 12:23
  • The machine has `4.7.0` and i want to run `4.7.2` targeted application. – finch Aug 10 '20 at 16:46
  • "I was able to run console application targeted to .net 4.7.2 on machine where .net 4.7.0 is installed." So you deleted or modified its `app.config` file to force it run on 4.7.0? That's pretty bad practice as the `app.config` tells .NET Framework whether this app should run. – Lex Li Aug 10 '20 at 16:48
  • actually, I just copied .exe file and executed. – finch Aug 10 '20 at 16:50
  • Without that `app.config`, .NET Framework 4.7.0 won't prevent any invalid applications (built against 4.7.1 and above) from running, but runtime exceptions are expected if the apps use more than 4.7.0 API surface. Your word of "safely" is contradictory. – Lex Li Aug 10 '20 at 16:54

1 Answers1

1

No there is no guarantee that this will be "safe". Your program might fail at runtime. One way to ensure that you can run your app, is to create an installer for your console application. This way you can execute this installer and it will install the necessary packages along with your application, and the target machine does not need to have Visual studio installed altogether.

snus74
  • 421
  • 3
  • 9