VS2008针对.NET 2.0不使用C#3的功能阻止我功能、NET

由网友(涐的恏、伱吥配知道)分享简介:我有一个VS2005的解决方案,并希望下车VS2005在新的一年。我主要是高兴的升级过程,并惊喜地看到,我的生成脚本大多仍然工作。I had a VS2005 solution and wanted to get off VS2005 for the new year. I was mostly happy wit...

我有一个VS2005的解决方案,并希望下车VS2005在新的一年。我主要是高兴的升级过程,并惊喜地看到,我的生成脚本大多仍然工作。

I had a VS2005 solution and wanted to get off VS2005 for the new year. I was mostly happy with the upgrade process and pleasantly surprised to see that my build scripts mostly still worked.

我的问题是围绕多目标的特点 - 我没有.NET 3.5安装在我的服务器上,所以我必须继续面向.NET 2.0。这工作,主要是,但我发现我可以做这样的事情

My question is around the multi-targeting feature - I don't have .NET 3.5 installed on my servers, so I have to continue to target .NET 2.0. That worked, mostly, but I found that I could do things like

var returnMe = "result: " + result.ToString();

......,目前仍是工程调试成功。

...and still debug the project successfully.

当我得到的code到构建服务器,构建失败,他说,VAR没有定义。

When I got that code up to the build server, the build failed, saying that "var" wasn't defined.

所以,这我应该期待?

在VS2008,针对.NET 2.0,当我尝试做应该抛出错误C#3事情 在构建服务器,是知道我针对.NET 2.0,应该明白我在做什么和编译的东西到2.0兼容的二进制

任何想法?

推荐答案

这个问题似乎是,在构建服务器的没有正确的编译器。您可以在工作站上建立了吧?

The problem appears to be that the build server does not have the right compiler. You can build it on your workstation, right?

很多的.NET 3.0功能只是语法比特恢复到CLR 2 code在编译时。 VAR 就是其中之一 - 当它编译,编译器变种转换为相应类型

Many of the .NET 3.0 "features" are just syntax bits that revert to CLR 2 code at compile time. var is one of them -- when it compiles, the compiler converts var to the appropriate type.

有一个pretty的信息张贴在此,在http://weblogs.asp.net/shahar/archive/2008/01/23/use-c-3-features-from-c-2-and-net-2-0-$c$c.aspx

There is a pretty informative post on this at http://weblogs.asp.net/shahar/archive/2008/01/23/use-c-3-features-from-c-2-and-net-2-0-code.aspx

阅读全文

相关推荐

最新文章