Does T4MVC work with Visual Studio 2010 Beta 2 and .Net 4?
Asked Answered
A

2

1

I cannot get the current build of T4MVC (2.6.02) to work with an ASP.NET MVC 2 project compiled against .NET 4 in VS2010 Beta 2.

There is one error:

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

Which is easily fixed by changing

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

to

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

And then the .generated.cs files are created, however I get a compile error in T4MVC.cs which says

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

Has anyone else experienced this?

Amourpropre answered 8/12, 2009 at 14:31 Comment(0)
A
2

Apparently you have to do a build first :) The compile message seems to go away afterwards.

Amourpropre answered 8/12, 2009 at 14:34 Comment(3)
Yes , the template generates the code needed once you build the applicationBobbibobbie
I'm having the same problem, but I can't seem to get it to work. When I build, I get the same message as you do about "namespace canot directly...", and when I open the generated .cs file it only says "Error generating code". Nothing I do seems to help...Curiel
Delete all the .generated.cs files, do a build, and then open up the .tt file and hit save (which should regenerate everything then). Also it looks like the author himself (David Ebbo) is here on SO so perhaps if you post some more info he can help out.Amourpropre
E
0

Note that the message about compiler version is just a warning and not an error. I'm not 100% why you were getting this error before the build, though. If you get it again, please try to capture more details about it (e.g. line number, ...) and let me know.

Exhilaration answered 13/12, 2009 at 20:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.