How To Fix "Unrecognized attribute targetFramework" Error

We may get the following error after publishing a website on IIS 7.5.

Parser Error Message

"Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive."

To fix it, we need to follow the below troubleshooting steps.

  1. Check on which .NET version the application is developed. Let's assume, it's .NET 4.0.

  2. Open IIS Manager and find the Application Pool, on which your website is hosted.

  3. Go to that Application Pool and check the .NET version and change it to 4.0 accordingly by clicking on Basic\Advanced Settings.

  4. If .NET 4.0 is not listed, go ahead and install it.

  5. If it still won't show up, go to command prompt and fire the below command to find a list of ASP.NET versions installed:

    C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -lv

  6. In the output, if .NET 4.0 is not listed, register it by firing the below command:

    C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -I.

  7. It should show up as .NET 4.0 in the .NET Framework Version dropdown for the application pool.