I'm using MVC 4 + Razor on Mono 3.0.7 without any problems. I develop in Visual Studio which adds all the MVC dependencies using NuGet packages. This means that deployment of an MVC 4 app is easier than MVC 3. I didn't have to manually copy any files, they're all handled by the regular build process. The deployment script basically publishes the site into a temp folder (using the MSBuild target) and then rsyncs this temp folder to the server. :)
The only gotcha with MVC 4 is that you need to set "Copy Local" of "Microsoft.Web.Infrastructure.dll" to false, as Mono has its own implementation. On Thu, Sep 12, 2013 at 3:18 PM, chris.schamper <[email protected]>wrote: > Hello, > > It seems that most tutorials about running MVC3/4 on Mono are centered > around Mono 2.X and an earlier release of MVC3. Having chased my tail > entirely too long trying to get a MVC3 Razor stack working, I wanted to > leave an updated tutorial in the hopes that this would save someone else > some effort. > > OS: Linux Mint 15 32-Bit Mate > Mono: Mono JIT compiler version 3.2.1 (Debian 3.2.1+dfsg-1~pre1+raring1) * > Monodevelop: Version 4.1.7 ** > .NET Framework: 4.5 > XSP: Github Tag 3.0.11, ce2f1f5bb9596d92f18492706be4356351409e68 > xsp-3.0.11.zip > Additional Files: > Missing dlls from a Windows .NET 4.5 MVC3 App + SHA1: > c8bcc63d2f05553424877956e4f51b4493ff6790 System.Web.Helpers.dll > a08b8ffc68482af25ec0bbc41f50f77e1ef70704 System.Web.WebPages.dll > 5dbf16560da6953ae6e28e8a94115b1ef3b5df50 System.Web.Mvc.dll > e7b48f758d24bae87ff8dead896c24e79890ca8f System.Web.WebPages.Razor.dll > 5d923740f2377298ad917eb9f5bfb45e0b1465fb > System.Web.WebPages.Deployment.dll > 6194d5363bc8cdab62e4f39151a1d1972880b8c7 System.Web.Razor.dll > > * I am using the following pre-release PPA: > https://launchpad.net/~directhex/+archive/monoxide > ** I am using the following Monodevelop PPA: > https://launchpad.net/~keks9n/+archive/monodevelop-latest > > I start Monodevelop and load the MVC3 Razor template. This template has two > missing references, System.Web.Helpers.dll and System.Web.WebPages. I add > these from a donor Windows machine hashes above. > > Building the project yields the following error: > Error CS1705: Assembly `System.Web.Mvc, Version=3.0.0.0, Culture=neutral, > PublicKeyToken=31bf3856ad364e35' references `System.Web.WebPages, > Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which > has > a higher version number than imported assembly `System.Web.WebPages, > Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' (CS1705) > (ForumExample) > > I then replace the template version with the Windows donor version. The > solution now builds. > > I have compiled the latest tagged version of XSP, 3.0.11. I am looking to > use XSP4 to host the MVC3 Razor .NET 4.5 app. When I run xsp4 against the > build directory, I get the following error: > > Message is Could not load file or assembly 'xsp4, Version=3.0.0.0, > Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its > dependencies. The system cannot find the file specified. > > OK, so off to gacutil: > sudo gacutil /i xsp4.exe > sudo gacutil /i Mono.WebServer2.dll > > OK, so now XSP4 at least starts: > xsp4 > Listening on address: 0.0.0.0 > Root directory: /home/chschamper/ForumExample/ForumExample > Listening on port: 8080 (non-secure) > Hit Return to stop the server. > Missing method Start in assembly > > /tmp/chschamper-temp-aspnet-0/477cf6c2/assembly/shadow/133f36d7/347ad6c0_2745e017_00000001/System.Web.Mvc.dll, > type System.Web.WebPages.Razor.PreApplicationStartCode > > Looks like there are some issues with one of the donor files. Connecting to > the server confirms it with an Error 500: > > System.IO.FileNotFoundException > Could not load file or assembly 'System.Web.WebPages.Razor, > Version=1.0.0.0, > Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its > dependencies. > > OK, so time to add another donor file, this time > System.Web.WebPages.Razor.dll. > > Rebuid and try xsp again: > xsp4 > Listening on address: 0.0.0.0 > Root directory: /home/chschamper/ForumExample/ForumExample > Listening on port: 8080 (non-secure) > Hit Return to stop the server. > > Ok, so no error on startup. Let's see if connecting to it works. > > And, no joy with another Error 500: > System.TypeLoadException > Could not load type 'System.Web.WebPages.Razor.WebCodeRazorHost' from > assembly 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, > PublicKeyToken=31bf3856ad364e35'. > > I went on a hunch since there is only one file from that series missing > from > the donor set: System.Web.WebPages.Deployment.dll > > Now to continue until the necessary donor files are present: > System.IO.FileNotFoundException > Could not load file or assembly 'System.Web.Razor, Verselpon=1.0.0.0, > Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its > dependencies. > > Add this file and try xsp again. > > Success! > > Welcome to ASP.NET MVC on Mono! > > I hope this helps someone else along the way. > > - Chris > > > > -- > View this message in context: > http://mono.1490590.n4.nabble.com/MVC3-Razor-XSP4-NET-4-5-Tutorial-tp4660852.html > Sent from the Mono - ASP.NET mailing list archive at Nabble.com. > _______________________________________________ > Mono-aspnet-list mailing list > [email protected] > http://lists.ximian.com/mailman/listinfo/mono-aspnet-list >
_______________________________________________ Mono-aspnet-list mailing list [email protected] http://lists.ximian.com/mailman/listinfo/mono-aspnet-list
