让 ninject / ninject.commons / ninject.web.mvc 与 Mono 2.10.x 和 ASP.NET MVC3 一起使用
目前正在做一个项目,是用VS2010开发的。我在虚拟机中运行 Windows,在那里我完成了大部分 .NET 开发,但我现在正在开发一个基于 ASP.NET MVC3 的新项目,所以我想我可以使用 Mono/MonoDevelop 来节省一些系统资源不运行 Windows VM(在以前的准系统 MVC2 应用程序上完美运行)。
新的 MVC3 项目正在使用 Ninject 和扩展。我不能只运行 xsp4
并让它工作(大量错误)。因此,我一直在尝试 git
各个项目(ninject、ninject.web.commons、ninject.web.mvc|ninject.mvc3)并构建它们。
(只是从 MonoDevelop 2.6 beta 2 中构建它们,使用 nant
构建失败)
Ninject 构建得很好,但我在构建其他版本时编译器崩溃了。这些甚至可以与 Mono 2.10.x 一起使用吗?如果是的话,有人成功地构建|使用它们了吗?
Currently working on a project that is being developed in VS2010. I'm running Windows in a VM, where I've done most .NET dev, but I'm now working on a new project that is ASP.NET MVC3 based so I thought I could use Mono/MonoDevelop to save some system resources by not running a Windows VM (Worked perfectly on a previous barebones MVC2 app).
The new MVC3 project is using Ninject, and extensions. I can't just run wth xsp4
and have it work (loads of errors). So I've been trying to git
the individual projects (ninject, ninject.web.commons, ninject.web.mvc|ninject.mvc3) and building them.
(just building them from within MonoDevelop 2.6 beta 2, no success building with nant
)
Ninject builds fine, but I get compiler crashes building the others. Do these even work with Mono 2.10.x? If so has anyone had any success building|using them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以我能够让这个工作正常进行,但不是我想象的那样。各种 Ninject 项目都有单声道构建等,但我仍然遇到问题。
我的第二次尝试是使用 MonoDevelop 从源代码构建。事实证明这是地狱,主要是 Ninject.MVC3(我们必须更改一堆匿名方法|调用才能让编译器满意)。我们最终成功了,但无济于事,它也无法让我们的项目正常运行。
所以,最后,我走上了一条不同的道路。
我刚刚将这些复制
到项目的 /bin 文件夹中。
更新了引用以指向 MonoDevelop 中的这些内容,因为 MVC 的 GAC 引用适用于版本 2),
我没有尝试将 Mono 版本用于任何与 Ninject 相关的内容,而是简单地使用了使用下载到 VS2010 的 .NET ninject DLL努格特。
然后一切几乎都成功了。该项目编译良好。
我剩下的唯一问题是 FreeTDS 在尝试与 SQL 服务器通信时无法工作。我完成了 FreeTDS 的工作,并使用 Python 和 pyodbc 对其进行了验证。 Mono 仍然无法连接,只是超时。我从 Mono 2.10.2 降级 -> 2.10.1,神奇的是,它起作用了。
通过 MonoDevelop 在 Mac 上运行我们的项目(不需要虚拟机来占用我的资源)...
所以现在我已经使用 MVC3、Razor、NHibernate、Ninject ...
So I was able to get this working, but not the way I had imagined. There are mono builds, etc., for the various Ninject projects, but I still had issues.
My second attempt was to just build from source, using MonoDevelop. This proved to be hell, mainly with Ninject.MVC3 (we had to change a bunch of the anonymous methods|calls to make the compiler happy). We eventually got this working, but to no avail, it too couldn't get our project working.
So, finally, I went down a different path.
I just copied these:
Into the /bin folder of the project.
Updated the references to point to these from within MonoDevelop, since it's GAC refs for MVC are for version 2)
Instead of trying to use the Mono versions for anything Ninject related, I just simply used the .NET ninject DLLs that were downloaded to VS2010 using NuGet.
Then everything, almost, worked. The project compiled fine.
The only issue I had left was that FreeTDS didn't work, while trying to communicate with a SQL server. I went through and got FreeTDS working, and verified it with Python and pyodbc. Mono still wouldn't connect, just timed out. I downgraded from Mono 2.10.2 -> 2.10.1 and, magically, it worked.
So now I've got our project working on my Mac with MonoDevelop (no VM needed to hog my resources) using MVC3, Razor, NHibernate, Ninject...
Phew.....