R – Precompiling ASP.NET MVC on Mono with Web Deployment Project

asp.net-mvcdeploymentmonoprecompile

I am trying to precompile and deploy my ASP.NET MVC application from Visual Studio 2008 to a server running Mono 2.4 using a Visual Studio 2008 Web Deployment Project. Whenever I go to the website, however, I get an error message:

This is a marker file generated by the
precompilation tool, and should not be
deleted!

Has anyone got this working? Is there a better way to precompile and deploy an MVC application from Visual Studio 2008 to Mono?

Best Answer

You need to make sure that when you used the aspnet_compiler command, you specified the virtual directory where the applications would reside with the -v command. For instance, if you want to build and serve a stock ASP.NET MVC application, Mvc1, from localhost/Mvc1, you would need to make sure you use the -v /Mvc1 switch:

aspnet_compiler -f -p c:\projects\Mvc1 -v /Mvc1 c:\test\output

Since this is an ASP.NET MVC application, I would also suggest making sure you explicitly configured Apache mod_mono, rather than depending on AutoHosting. I discussed why in my answer to "Mono 2.4, AutoHosting and MVC".

You can now use the Apache mod_mono configuration tool hosted on the mono website.