Getting Unrecognized Attribute Target Framework Exception

In this article I will demonstrate why you get the "Unrecognized attribute target Framework" exception.

Introduction

Take a real scenario in the coding in which you are working with Visual Studio 2012 or 2013 and you want to deploy your application to your server but you don't know which .Net framework is supported by the server.

For example, you created a website using the 4.5 .Net Framework, and deploy it on the server and your server doesn't support the 4.5 .Net framework. So in this case you will get the Unrecognized attribute target Framework exception.

To show this case in this article, I will create the following 2 websites:

  • Website using 4.5 .Net framework
  • Website using 3.5 .Net framework

Use the following procedure to do this.

Note: My server is running under the 4.5 .Net Framework.

Step 1

  1. Create a website using the 4.5 .Net Framework named "Website_Latest".

    Create a website

  2. The default functionalities will look like:

    Default functionalities

  3. Run the "Deafult.aspx" page of the website on the development system that will look like this:

    Run

  4. Now change the value of the "mode" property of the "custom errors" tag to get the actual error at runtime on the server.

    Note: the "custom errors" tag exists with in the <system.web></system.web> section.

    <customErrors mode="Off">
    </customErrors>

    custom errors
     
  5. Publish the website on the server.

    Publish the website

  6. Now run the default page.

    run the default page

There is an error when I deploy the 4.5 .Net Framework website on the server that is running under the 3.5.Net Framework.

Step 2

  1. Create a website using the 3.5 .Net Framework named "WebSite_old".

    Create website

  2. Add some text into the default page.

    Add some text

  3. Run the "Deafult.aspx" page of the website on the development system, that will look like this:

    Run

  4. Publish the website on the server.

    Publish the website

  5. Now run the default page.

    run the page

Summary

Now you can understand why you are getting this exception and if you want to resolve this issue.

  1. Upgrade the Framework to 4.5 .Net framework on the server if your website uses the 4.5 .Net Framework
  2. Create the website with the 3.5 .Net Framework


Similar Articles