编译器版本与.NET Framework版本 - 方案与ASP.NET应用程序 [英] Compiler Version vs. NET Framework Version - Scenario with ASP.NET applications

查看:233
本文介绍了编译器版本与.NET Framework版本 - 方案与ASP.NET应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

方案:

我有VS 2010(C#编译器4)我的客户机定位3.5。

I have VS 2010 (C# 4 compiler) targeting 3.5 on my client machine.

我开发ASP.NET应用程序。我在一个类文件中使用可选参数(支持C#4)和编译code一切似乎很好地工作。

I am developing ASP.NET applications. I use optional parameters (C# 4 supported) in a class file and compile the code everything appears to work fine.

后来被发现在运行时,其中一个老(经典我相信)ASPX是使用功能的问题。无函数接受只有X参数,其中x是不是可选的参数少一个是运行时错误。

Later on an issue that is discovered at Runtime where an old (classic I believe) ASPX is using the function. No function accepts only x arguments where x is one less than the optional parameter is the runtime error.

这是否意味着正常类和这种使用C#编译器的客户端,而意见(CSS),这一做法的编译器在服务器上 - 从而造成问题,如果C#4中使用视图/格式的文件

Does this mean normal classes and such use the C# compiler of the client, while the views (aspx) and such use the compiler on the server - thus causing issues if C# 4 is used in view/form files?

推荐答案

我相信这是同该ASPX页面(重?)汇编的第一次加载由IIS而不是被编译在Visual Studio中的事实。这使得他们能够进行更新的,不需要重新编译飞,但是因为他们是由IIS编译它带给你所看到的并发症。

I believe this has to do with the fact that aspx pages are (re?)compiled on first load by IIS rather than being compiled in Visual Studio. This allows them to be updated on the fly without recompiling, however since they're compiled by IIS it brings the complications you're seeing.

我不知道一个办法让IIS使用C#编译器4,但编译到.NET 3.5,因此看起来像你的唯一选项是:

I'm not aware of a way to have IIS use the C#4 compiler but compile to .NET 3.5 so it seems like your only options are:

  1. 更新到.NET 4
  2. 请不要使用可选参数
  3. 请不要调用使用可选参数在.aspx文件code。如果您将调用codebehind文件时,它应该工作的罚款我猜,但我还没有尝试过。

这篇关于编译器版本与.NET Framework版本 - 方案与ASP.NET应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆