开发者

Getting ninject / ninject.commons / ninject.web.mvc working with Mono 2.10.x and ASP.NET MVC3

开发者 https://www.devze.com 2023-02-27 03:28 出处:网络
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 th

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 th开发者_开发百科em.

(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?


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:

System.Web.Helpers.dll
System.Web.Mvc.dll
System.Web.Razor.dll
System.WebPages.Deployment.dll
System.Web.WebPages.dll
System.WebPages.Razor.dll

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.....

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号