Unrecognized attribute ‘targetFramework’ when deploying asp.net 4.0

Posted on: May 29, 2010

Getting the following error when you deploy your first asp.net 4.0 website:

Unrecognized attribute ‘targetFramework’. Note that attribute names are case-sensitive.

is most likely because of either of 2 reasons:

1. You installed the .net 4.0 bits after IIS was set up, resulting in the wrong version of the .NET framework beeing registered with IIS.

Most often the above results in conflicting versions of the framework, and so the easiest way of solving this is to re-register the .NET extensions with IIS using the aspnet_regiss tool. Make sure you run it from an elevated command prompt and that you use the correct version (in the v4.xx folder that is, not the v2.xx one). On my dev machine this tool is located in:


and you run it with the -iru flags like so:

aspnet_regiis.exe -iru

2. You haven’t set the framework of the IIS application to the correct version of .NET (4.0 that is)

Change this using either the IIS Manager or the command line. In IIS Manager you select ‘Application Pools’, click the Application you’ve pointed you site to use, select ‘Basic Settings’ in the ‘Actions’ pane and change the ‘.NET framework version’.

This post over at MSDN should also be of great help. Gotta love Microsoft’s documentation!



18 Responses to "Unrecognized attribute ‘targetFramework’ when deploying asp.net 4.0"

This is helpful. Thank you.

Best Regards,
Meganadha Reddy K.

Totally what I was looking for.

Resolved my problem. Thanks!

am sorted thoroughly, thanks man

Thx, It helped me

Hi guys, how are you? I’m still getting this error!!!

I’ve done everything I could to make it work, but it just won’t. Here’s my timeline for the past few days:

1) Running Win Vista IIS 7 .NET FW 2.0.
2) Formatted computer and installed Win 7 IIS 7.5 as well as all its features as well as VS2008. (in the hopes of targetFramework to work)
3) Installed .NET 4.0.
4) Started VS2008 and when I opened the localhost it said the site was using .NET FW 2.0 and asked me if I wanted to switch to 3.5. I said yes and the conversion was a success.
5) Tried to run site but got same error message.
6) Spent 3 days on the internet attempting to figure out what went wrong.
7) I did what you recommended. Restarted computer, also did not work. I’m getting desperate. Please help!

NOTE: When I try to start a new web site with VS2008, I do not have the option of picking .NET FW 4.0. Just 2.0 -> 3.5. What is going on!?!?

Thank you!

It helps me :)

Try this fix that worked for me. I posted the response here (search for ‘goHiker’):


Regards… Terry

Really nice post. Resolved my problem :)

Thank you!

Dude I love you :D solved my problem. I installed .net 4.0 after IIS that was my problem! thank you!

No Problem, glad you found it helpful!

Thanks a Lot man… Works like a cake..

Solved my problem. Thanks so much

Thanks a lot

This is excellent yaar….its helps me to run MVC 3.0 Razor app on IIS 7.
Thanks a Lot!

I had the same problem but using VS’ virtual server not IIS.
So here an article that could help you if you have the same problem:

This is right solution… Thanks a lot for this.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


This blog has no clear focus. It has a focus though, it's just not very clear at the moment...

Dev Env.

Visual Studio 2008 Prof / NUnit / Gallio / csUnit / STools (ExactMagic) / doxygen / dxCore / TypeMock / TestDriven.net / SequenceViz / CLRProfiler / Snoop / Reflector / Mole / FxCop / Subversion / TortoiseSVN / SlikSVN / CruiseControl.net / msbuild / nant

Blog Stats

  • 81,617 hits