我可以在Visual Studio 2008中为。net Framework 4开发吗?

时间:2023-01-16 15:06:15

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.)

我的ASP。NET应用程序在我的web服务器上的IIS中运行,并使用Microsoft .NET Framework 4 Beta 2。(其应用程序池设置为。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.

这是由于。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:

恢复到ASP的行为。NET 2.0请求验证特性,我在Web中添加了以下设置。配置文件:

<httpRuntime requestValidationMode="2.0" />

Now Visual Studio 2008 throws a compile-time error:

现在Visual Studio 2008抛出一个编译时错误:

The 'requestValidationMode' attribute is not declared.

“requestValidationMode”属性没有声明。

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

而且我不能再用ASP来调试我的开发机器了。Visual Studio附带的NET开发服务器。

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

我需要Visual Studio和它的ASP。NET开发服务器识别新的。NET Framework 4 requestValidationMode属性。

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

如何在。net 4中调试应用程序?我必须从Visual Studio 2008切换到Visual Studio 2010 Beta 2吗?

7 个解决方案

#1


31  

You cannot use Visual Studio 2008 to develop 4.0 applications in a supported manner. Currently only Visual Studio 2010 can be used to develop 4.0 apps. Starting with 2008 you can use it to develop for earlier versions of the framework but not later ones.

不能使用Visual Studio 2008以受支持的方式开发4.0应用程序。目前只有Visual Studio 2010可以开发4.0应用程序。从2008年开始,您可以使用它来开发框架的早期版本,而不是以后的版本。

#2


15  

From ScottGu's blog:

从ScottGu的博客:

There isn't any way to target .NET 4 from VS08 and use new features. Having said that, .NET4 is upwards comaptible with .NET 3.5 - so applications you build targeting .NET 3.5 with VS08 should work fine on top of .NET 4.

从VS08到。net 4,没有任何方法可以使用新的特性。话虽如此,. net4与。net 3.5是可以兼容的——所以你用VS08构建的。net 3.5应用应该可以在。net 4之上运行得很好。

#3


3  

The only way to develop for .NET 4 is to use Visual Studio 2010. However, if you do create a managed assembly in Visual Studio 2008, you could run in on a machine with .NET 4 run-time installed.

为。net 4开发的唯一方法是使用Visual Studio 2010。但是,如果您在Visual Studio 2008中创建托管程序集,您可以在安装了. net 4运行时的机器上运行。

#4


3  

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.

此前许多Visual Studio版本,你不能开发更高版本框架应用程序(在本问题。net 4.0)使用一个低版本的Visual Studio框架(在Visual Studio 2008这个问题),只是和你一样不能开发3.5应用程序在Visual Studio 2005中,等等等等。

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.

您可以尝试从。net 3.5更新到。net 4.0(例如,使用System)。每次开发应用程序时,从。net 4.0而不是项目直接引用的那个dll,但是我认为它不会识别新框架版本中的新特性。

#5


1  

My guess is that you have found one of those fabulous cases where it is just going to complain to no end. You will likely be better off using the beta of VS2010 or removing the validationMode attribute.

我的猜测是,你已经发现了一个令人难以置信的案例,它将无休止地抱怨。您最好使用VS2010的beta版本或者删除validationMode属性。

You could, in theory, try attaching to appropriate worker process and get some debugging love - but it still might not work.

理论上,您可以尝试附加到适当的worker进程,并获得一些调试方面的支持——但它可能仍然不能工作。

#6


1  

You can target the .NET Framework 4.0 using Visual Studio 2008. You just have to wait for the right plugins (create Silverlight 4 projects, etc.). For instance, you can use .NET Framework 3.5 in Visual Studio 2005 with the correct SDK.

您可以使用Visual Studio 2008开发。net Framework 4.0。你只需要等待合适的插件(创建Silverlight 4项目,等等)。例如,您可以在Visual Studio 2005中用正确的SDK使用. net Framework 3.5。

#7


0  

If you want to develop for .NET 4 without the pricey Visual Studio 2010 Pro, you can try Mono:

如果你想在没有昂贵的Visual Studio 2010 Pro的情况下为。net 4开发,你可以试试Mono:

Mono Project

Mono项目

#1


31  

You cannot use Visual Studio 2008 to develop 4.0 applications in a supported manner. Currently only Visual Studio 2010 can be used to develop 4.0 apps. Starting with 2008 you can use it to develop for earlier versions of the framework but not later ones.

不能使用Visual Studio 2008以受支持的方式开发4.0应用程序。目前只有Visual Studio 2010可以开发4.0应用程序。从2008年开始,您可以使用它来开发框架的早期版本,而不是以后的版本。

#2


15  

From ScottGu's blog:

从ScottGu的博客:

There isn't any way to target .NET 4 from VS08 and use new features. Having said that, .NET4 is upwards comaptible with .NET 3.5 - so applications you build targeting .NET 3.5 with VS08 should work fine on top of .NET 4.

从VS08到。net 4,没有任何方法可以使用新的特性。话虽如此,. net4与。net 3.5是可以兼容的——所以你用VS08构建的。net 3.5应用应该可以在。net 4之上运行得很好。

#3


3  

The only way to develop for .NET 4 is to use Visual Studio 2010. However, if you do create a managed assembly in Visual Studio 2008, you could run in on a machine with .NET 4 run-time installed.

为。net 4开发的唯一方法是使用Visual Studio 2010。但是,如果您在Visual Studio 2008中创建托管程序集,您可以在安装了. net 4运行时的机器上运行。

#4


3  

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.

此前许多Visual Studio版本,你不能开发更高版本框架应用程序(在本问题。net 4.0)使用一个低版本的Visual Studio框架(在Visual Studio 2008这个问题),只是和你一样不能开发3.5应用程序在Visual Studio 2005中,等等等等。

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.

您可以尝试从。net 3.5更新到。net 4.0(例如,使用System)。每次开发应用程序时,从。net 4.0而不是项目直接引用的那个dll,但是我认为它不会识别新框架版本中的新特性。

#5


1  

My guess is that you have found one of those fabulous cases where it is just going to complain to no end. You will likely be better off using the beta of VS2010 or removing the validationMode attribute.

我的猜测是,你已经发现了一个令人难以置信的案例,它将无休止地抱怨。您最好使用VS2010的beta版本或者删除validationMode属性。

You could, in theory, try attaching to appropriate worker process and get some debugging love - but it still might not work.

理论上,您可以尝试附加到适当的worker进程,并获得一些调试方面的支持——但它可能仍然不能工作。

#6


1  

You can target the .NET Framework 4.0 using Visual Studio 2008. You just have to wait for the right plugins (create Silverlight 4 projects, etc.). For instance, you can use .NET Framework 3.5 in Visual Studio 2005 with the correct SDK.

您可以使用Visual Studio 2008开发。net Framework 4.0。你只需要等待合适的插件(创建Silverlight 4项目,等等)。例如,您可以在Visual Studio 2005中用正确的SDK使用. net Framework 3.5。

#7


0  

If you want to develop for .NET 4 without the pricey Visual Studio 2010 Pro, you can try Mono:

如果你想在没有昂贵的Visual Studio 2010 Pro的情况下为。net 4开发,你可以试试Mono:

Mono Project

Mono项目