繁体   English   中英

使用C#在ASP.NET MVC 4中脚手架控制器时出错

[英]Error when scaffolding controller in asp.net mvc 4 with c#

搭建模型“发件人”时出现以下错误。 发件人模型位于名为BmbMessenger.Data的类库项目中,并且在BmbMessenger.AccountManager中引用了该项目的dll,但由于某些原因,无法引用“发件人”模型来使脚手架正常运行。 我也尝试使用gui脚手架工具,但无济于事。 我对为什么脚手架不起作用感到困惑。

Scaffold Controller Switch -DbContextType BmbMessengerContext -Verbose -Repository -Project BmbMessenger.AccountManager -ModelType Switch
Get-ProjectType : Cannot find a type matching the name 'Switch'. Try specifying the fully-qualified type name, including namespace.
At C:\Users\Andrew\Documents\Visual Studio 2012\Projects\BmbMessenger\packages\MvcScaffolding.1.0.9\tools\Controller\MvcScaffolding.Controller.ps1:50 char:35
+     $foundModelType = Get-ProjectType <<<<  $ModelType -Project $Project
    + CategoryInfo          : NotSpecified: (:) [Get-ProjectType], InvalidOperationException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.GetProjectTypeCmdlet

添加新模型,更改模型或导入现有模型时,应首先构建项目,然后尝试将.tt实体类用作脚手架模型。

希望能有所帮助

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM