[英]MEF with MVC 5, mixing C# and VB.NET
I have a VB.NET Solution that uses MVC 5 and MEF to give me a pluggable web project. 我有一个使用MVC 5和MEF的VB.NET解决方案,为我提供了可插入的Web项目。
It has a "Host" project that runs and loads all the DLL's dynamically, using MEF, I then load the controllers and everything works nicely. 它有一个“主机”项目,该项目使用MEF动态运行并加载所有DLL,然后加载控制器,一切正常。 I add a new project, add the Plugin Registration and use MEF to export the controller.
我添加一个新项目,添加插件注册并使用MEF导出控制器。 Bam, project standalone that fits in my framework.
Bam,适合我框架的独立项目。
However, I'd like to now add a C# project instead. 但是,我现在想添加一个C#项目。 I've added the cshtml stuff to my custom ViewEngine, and it copies the views/dll's to the host's plugin directory, however, when rendering the view, I get this error:
我已经将cshtml内容添加到我的自定义ViewEngine中,并将视图/ dll复制到主机的插件目录,但是,在渲染视图时,出现此错误:
Compiler Error Message: CS0234: The type or namespace name 'CSharpTest' does not exist in the namespace 'MVCMEFPluggable' (are you missing an assembly reference?) 编译器错误消息:CS0234:类型或名称空间名称'CSharpTest'在名称空间'MVCMEFPluggable'中不存在(您是否缺少程序集引用?)
And errors on Line 28: 第28行的错误:
using MVCMEFPluggable.CSharpTest; 使用MVCMEFPluggable.CSharpTest;
This goes to a temporary file created in the ASP.NET Temporary Files folder. 这将转到在ASP.NET临时文件文件夹中创建的临时文件。 I can remember something about the differences in namespaces when it comes to VB.NET and C#, but I can't figure out what to do to get the view to render properly.
我记得一些有关VB.NET和C#的名称空间差异的信息,但我不知道该怎么做才能正确呈现视图。
Any insights? 有什么见解吗?
在web.config文件中,添加了程序集“ MVCMEFPluggable.CSharpTest”作为参考,删除了该行,使cshtml可以在vb.net环境中编译并成功运行:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.