1

我无法让当前版本的 T4MVC (2.6.02) 与在 VS2010 Beta 2 中针对 .NET 4 编译的 ASP.NET MVC 2 项目一起使用。

有一个错误:

  • The C# 2.0 and C# 3.5 compilers are no longer supported. Templates will always be compiled with the version 4 compiler instead of 'v3.5' as specified.

这很容易通过改变来修复

<#@ template language="C#v3.5" debug="true" hostspecific="true" #>

<#@ template language="C#" debug="true" hostspecific="true" #>

然后.generated.cs创建文件,但是我收到一个编译错误,T4MVC.cs其中说

error CS0116: A namespace cannot directly contain members such as fields or methods.

有没有其他人经历过这个?

4

2 回答 2

2

显然你必须先进行构建:) 编译消息似乎在之后消失了。

于 2009-12-08T14:34:12.627 回答
0

请注意,有关编译器版本的消息只是警告而不是错误。不过,我不是 100% 为什么您在构建之前收到此错误。如果您再次得到它,请尝试捕获有关它的更多详细信息(例如行号,...)并告诉我。

于 2009-12-13T20:13:48.950 回答