0

I've created a simple console app (to run on .NET framework).

Running the app I see the following message:

enter image description here

But I have this version installed as can seen in the drop down:

enter image description here

enter image description here

Anyone familiar with this?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
K.W
  • 123
  • 7
  • 1
    Have you seen this? https://stackoverflow.com/questions/44237105/this-application-requires-one-of-the-following-versions-of-net-framework – phuzi Sep 01 '22 at 10:16

3 Answers3

0

As phuzi said. As phuzi said.

Configure the app.config file:

   <supportedRuntime version="v4.0" sku=".NETFramework, Version = v4.8.2"/>

Official Microsoft documentation: link.

Hope it helps you.

Housheng-MSFT
  • 1
  • 1
  • 1
  • 9
0

In your picture the Target Framework is what version of .NET you are TARGETing, in other words, what version the end user will need to have installed on their machine.

As a test, you can find out what version of the .NET framework is currently installed on your machine using the script below from MSDN:

    $release = Get-ItemPropertyValue -LiteralPath 'HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' -Name Release
switch ($release) {
    { $_ -ge 533320 } { $version = '4.8.1 or later'; break }
    { $_ -ge 528040 } { $version = '4.8'; break }
    { $_ -ge 461808 } { $version = '4.7.2'; break }
    { $_ -ge 461308 } { $version = '4.7.1'; break }
    { $_ -ge 460798 } { $version = '4.7'; break }
    { $_ -ge 394802 } { $version = '4.6.2'; break }
    { $_ -ge 394254 } { $version = '4.6.1'; break }
    { $_ -ge 393295 } { $version = '4.6'; break }
    { $_ -ge 379893 } { $version = '4.5.2'; break }
    { $_ -ge 378675 } { $version = '4.5.1'; break }
    { $_ -ge 378389 } { $version = '4.5'; break }
    default { $version = $null; break }
}

if ($version) {
    Write-Host -Object ".NET Framework Version: $version"
} else {
    Write-Host -Object '.NET Framework Version 4.5 or later is not detected.'
}

Copy and paste the Powershell script above into Powershell ISE and click the green button to run. Then once it tells you what version of .NET you have, change the Target Framework drop-down box to match that version.

Also keep in mind, this procedure is only for testing. If you're going to make a real application, you need to determine what version of .NET you're going to develop for and then probably make a setup program that will install this dependency if it doesn't exist on the end-user's machine.

public wireless
  • 767
  • 8
  • 20
-1

I was fortunate to experience this, some forums talking about changes in the registry but what worked was to comment out the supportedRuntime element in the configuration file of the application.

Supported runtime element

enter image description here

Theres an interesting post here: What happens when removing auto added supportedRuntime element

jmvcollaborator
  • 2,141
  • 1
  • 6
  • 17