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
- Create a website using the 4.5 .Net Framework named "Website_Latest".

- The default functionalities will look like:

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

- 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>
- Publish the website on the server.

- Now 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
- Create a website using the 3.5 .Net Framework named "WebSite_old".

- Add some text into the default page.

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

- Publish the website on the server.

- Now run the default page.

Summary
Now you can understand why you are getting this exception and if you want to resolve this issue.
- Upgrade the Framework to 4.5 .Net framework on the server if your website uses the 4.5 .Net Framework
- Create the website with the 3.5 .Net Framework

Rahul BansalPosted Apr 7, 2014, 10:23 AM
Thanks Lakshmanan
Lakshmanan Sethu SankaranarayanPosted Apr 7, 2014, 10:04 AM
Good piece of Info:-)