1

NOT A DUPLICATE / NOT ANSWERED IN OTHER THREADS None of the indicated duplicates are the problem I'm having since I already have 4.7.2 installed on the server.

I have an app (wcf service) compiled to 4.7.2. All of the projects in the solution target that framework version.

On the server (Windows Server 2016), Framework 4.7.2 is installed (and is reported as ASP.NET Version:4.7.3282.0 in the error page)

The error that's being thrown when I browse to the WCF service:

The 'targetFramework' attribute in the element of the Web.config file is used only to target version 4.0 and later of the .NET Framework (for example, ''). The 'targetFramework' attribute currently references a version that is later than the installed version of the .NET Framework. Specify a valid target version of the .NET Framework, or install the required version of the .NET Framework.

Here's the indicated error lines from the web config (error is on line 25):

Line 23: </appSettings>
Line 24: <system.web>
Line 25: <compilation targetFramework="4.7.2" />
Line 26: <httpRuntime targetFramework="4.7.2" />
Line 27: <customErrors mode="Off" />

If I open a command prompt and go to the c:\windows\microsoft.net\framework64\v4.0.30319 directory and run msbuild -version, it responds

4.7.2053.0

I tried changing around some app pool settings to no avail. Anyone have some ideas?

Edit: The error page (when running under localhost) is reporting this version information: Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3282.0

Edit 2: I downgraded all the solutions in my project to version 4.7, and that seems to have resolved the issue. I don't know why since the server gives every indication that it's got 4.7.2 installed.

Tom
  • 163
  • 1
  • 11
  • Check this out: https://stackoverflow.com/questions/3538870/what-does-aspnet-regiis-exe-do – JuanR Feb 11 '19 at 14:51
  • Possible duplicate of [Getting Error "The 'targetFramework' attribute currently references a version that is later than the installed version of the .NET Framework"](https://stackoverflow.com/questions/13545986/getting-error-the-targetframework-attribute-currently-references-a-version-th) – JuanR Feb 11 '19 at 14:52
  • Thanks Juan for your reply, unfortunately the aspnet_regiis tool isn't supported on Windows Server 2016 running IIS 10 apparently. – Tom Feb 11 '19 at 15:14
  • I would recommend reinstalling the .NET framework. – JuanR Feb 11 '19 at 15:53
  • Is it hosted on IIS? maybe you should check the application pool settings. – Stefan Feb 11 '19 at 18:09
  • So, interestingly enough, if I downgrade all of the projects to 4.7, it works. 4.7.1 and 4.7.2 do not, despite the fact that my server says I have 4.7.2 installed. – Tom Feb 11 '19 at 18:22

1 Answers1

2

Microsoft, in their infinite versioning wisdom, has deemed that the MS Build version I was seeing (4.7.2053.0) is actually Framework version 4.7. What's more, the version indicated on the error page (4.7.3282.0) is actually the ASP.NET version, which is different than the Framework version.

So, despite all indications that I was on version 4.7.2 (to include our server admin saying we were), we were actually on 4.7.

Once we installed version 4.7.2, things worked.

One thing to check is the actual release that's installed:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client

The value of the Release key should be 461814 for 4.7.2.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Tom
  • 163
  • 1
  • 11
  • Wow, I think I'm in the same boat, (right down to the server admin telling me we had 4.7.2 installed). I was finally able to get some proof by throwing an error on the server application telling me the release number using [this page](https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed) and using C# to read the Registry Key. FYI, for 4.7.2, the key should be in [461808, 428040). I think the registry key might also be `Full` instead of `Client`. – General Grievance Jul 27 '22 at 18:24