Can I develop for .NET Framework 4 in Visual Studio 2008?

Viewed 80864

My ASP.NET application runs in IIS on my web server and uses Microsoft .NET Framework 4 Beta 2. (Its Application Pool is set to .NET Framework version .NET Framework v4.0.21006.)

It gives this new error:

A potentially dangerous Request.Form value was detected from the client...

This is due to a breaking change in .NET 4.

To revert to the behavior of the ASP.NET 2.0 request validation feature, I added the following setting in the Web.config file:

<httpRuntime requestValidationMode="2.0" />

Now Visual Studio 2008 throws a compile-time error:

The 'requestValidationMode' attribute is not declared.

And I can no longer debug on my development machine using the ASP.NET Development Server that comes with Visual Studio.

I need Visual Studio and its ASP.NET Development Server to recognize the new .NET Framework 4 requestValidationMode attribute.

How can I debug my application in .NET 4? Must I switch from Visual Studio 2008 to Visual Studio 2010 Beta 2?

7 Answers

As many previous Visual Studio releases, you cannot develop a higher version framework application (in this question .NET 4.0) using a Visual Studio for a lower version framework (in this question Visual Studio 2008), just the same as you can't develop 3.5 applications in Visual Studio 2005, and so on and so forth.

You may try updating the references from .NET 3.5 to .NET 4.0 (for example, using System.dll from .NET 4.0 instead of the one referenced directly by the project) every time you develop applications, but I don't think it would recognize the new features from the new framework version.

Related