为什么是"Multiple types were found that match the controller named 'ViewSwitcher'"?
Why are "Multiple types were found that match the controller named 'ViewSwitcher'"?
我有一个基于 MVC 5 的解决方案,有一个 Client
和 Data
项目。它包括部分 _ViewSwitcher
,因为我想为移动和桌面浏览器提供服务。在主页上,当我单击 ViewSwitcher 的 Mobile view
link 时,出现以下异常:
Multiple types were found that match the controller named 'ViewSwitcher'....
The request for 'ViewSwitcher' has found the following matching controllers:
PayCaddy.Data.Controllers.ViewSwitcherController
PayCaddy.Client.Controllers.ViewSwitcherController
我已经针对术语(不是整个单词)'ViewSwitcher', and found only one .cs result, in the
.Clientproject, and three results in
_Layout.Mobile.cshtmland
_ViewSwitcher.cshtml 对所有文件进行了广泛的搜索`。另外,我手动检查了文件系统是否有任何重复项,并发现 none.
可能是什么原因造成的?
事实证明 Client
引用了 Data
的旧 DLL,而不是 Data
项目,即它是 'assembly reference' 而不是 'project reference'.删除旧的 DLL,并将引用切换到项目引用就可以了。但是,之前我不得不删除 Data
的所有 using
语句,重建并得到错误,然后替换所有 using
。现在一切正常。
我有一个基于 MVC 5 的解决方案,有一个 Client
和 Data
项目。它包括部分 _ViewSwitcher
,因为我想为移动和桌面浏览器提供服务。在主页上,当我单击 ViewSwitcher 的 Mobile view
link 时,出现以下异常:
Multiple types were found that match the controller named 'ViewSwitcher'....
The request for 'ViewSwitcher' has found the following matching controllers:
PayCaddy.Data.Controllers.ViewSwitcherController
PayCaddy.Client.Controllers.ViewSwitcherController
我已经针对术语(不是整个单词)'ViewSwitcher', and found only one .cs result, in the
.Clientproject, and three results in
_Layout.Mobile.cshtmland
_ViewSwitcher.cshtml 对所有文件进行了广泛的搜索`。另外,我手动检查了文件系统是否有任何重复项,并发现 none.
可能是什么原因造成的?
事实证明 Client
引用了 Data
的旧 DLL,而不是 Data
项目,即它是 'assembly reference' 而不是 'project reference'.删除旧的 DLL,并将引用切换到项目引用就可以了。但是,之前我不得不删除 Data
的所有 using
语句,重建并得到错误,然后替换所有 using
。现在一切正常。