安装 ASP.NET MVC 3 后构建服务器表现不佳?
我们有一个正在使用 TeamCity 构建的现有 MVC 应用程序,一切进展顺利,直到我们需要开始在同一构建服务器上构建不同的 MVC 3 应用程序...
安装 MVC 3 后,我们开始收到第一个构建错误MVC 2 项目是:
T4MVC.cs(112, 11): error CS0012: The type 'System.Web.WebPages.Razor.WebRazorHostFactory' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
T4MVC.cs(112, 11): error CS0012: The type 'System.Web.WebPages.StartPage' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
好的,没问题。我添加了这些程序集作为引用,然后收到了一个不同的错误:
CustomViewEngine.cs(44,9): error CS1502: The best overloaded method match for 'System.Web.Mvc.WebFormView.WebFormView(System.Web.Mvc.ControllerContext, string)' has some invalid arguments
所以此时,我想我已经在楼梯上了,我已经恢复了我的更改。根本问题似乎是 T4 注意到 MVC 3 可用,并且正在使用 MVC 3 而不是 MVC 2。情况可能如此吗?如果是这样,我该如何解决这个问题?似乎没有办法在 T4 设置文件中指定 MVC 2。
我不是一个经常在T4里闲逛的开发者,所以我在这一点上感到有点失落!
当然,一切都在我的工作站上本地构建得很好。
任何建议将不胜感激!
We have an existing MVC application that we're building using TeamCity and things were going great until we needed to start building a different MVC 3 application on the same build server...
After installing MVC 3, the first build error we starting receiving in the MVC 2 project was:
T4MVC.cs(112, 11): error CS0012: The type 'System.Web.WebPages.Razor.WebRazorHostFactory' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
T4MVC.cs(112, 11): error CS0012: The type 'System.Web.WebPages.StartPage' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
OK, no problem. I added these assemblies as references, and then received a different error:
CustomViewEngine.cs(44,9): error CS1502: The best overloaded method match for 'System.Web.Mvc.WebFormView.WebFormView(System.Web.Mvc.ControllerContext, string)' has some invalid arguments
So at this point, I think I'm on the stairway to heck, and I've reverted my changes. The underlying problem seems to be T4 noticing that MVC 3 is available, and is using MVC 3 instead of MVC 2. Could this be the case? If so, how do I fix this? There doesn't seem to be a way to specify MVC 2 in the T4 settings file.
I'm not the developer who usually mucks around in T4, so I'm feeling a bit lost a this point!
Of course, everything is building fine locally on my workstation.
Any advice would be greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我发现问题了。
在 MVC 2 项目中,对 System.Web.Mvc 的引用将“特定版本”设置为 false。这有点令人不安,因为特定版本的默认值对于 MVC 2 项目来说是正确的。我确信 Mercurial 会帮助我
指出某人确定此错误的根源。向所有看过这个问题的 T4 专家致歉,因为我最初包含了 T4 标签!
OK, I found the problem.
In the MVC 2 project, the reference to System.Web.Mvc had 'Specific Version' set to false. This is a little unsettling since the default value for Specific Version is true for an MVC 2 project. I'm sure Mercurial will help me
point the finger at someonedetermine the source of this error.Apologies all around to any T4 gurus who looked at this question because I included the T4 tag originally!