gpt4 book ai didi

visual-studio-2008 - 使用 T4MVC 时的命名空间错误

转载 作者:行者123 更新时间:2023-12-04 08:50:44 27 4
gpt4 key购买 nike

刚刚听说 T4MVC,但我无法让它在我的示例项目(ASP.NET MVC 2,Visual Studio 2008)中工作。

尝试构建项目时出现以下错误:

Error 1 The type or namespace name 'Account' does not exist in the namespace 'Northwind.Web.MVC' (are you missing an assembly reference?) C:\Users\Bruno\Documents\My Dropbox\Projetos.NET\Northwind\Northwind.Web.MVC\AccountController.generated.cs 38 61 Northwind.Web.MVC



这是发生错误的地方:
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public AccountController Actions { get { return MVC.Account; } }

我真的很讨厌魔法弦,所以请帮我让它工作!

最佳答案

看起来像 T4MVC 和您的代码之间的命名空间冲突。转到 T4MVC.settings.t4 并找到以下代码:

// The prefix used for things like MVC.Dinners.Name and MVC.Dinners.Delete(Model.DinnerID)
const string HelpersPrefix = "MVC";

只需将“MVC”更改为其他内容,您就可以开始了:)

或者,您可以根据需要重命名命名空间 (Northwind.Web. MVC )

关于visual-studio-2008 - 使用 T4MVC 时的命名空间错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3902914/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com