Visual Studio + Deployable Dependencies
Posted by Diego em Setembro 15, 2012
So there I was deploying my Web Application, MVC + Razor + EF + everything else when I got this error:
Parser Error Message: Could not load file or assembly ‘System.Web.Helpers, Version=184.108.40.206, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
Ah, dll errors!!!
Instead of coping manually the dlls or setting the “copy local” property to true, I decided to let Visual Studio S do that for me by adding the deployable dependencies for razor:
After doing that, my application, that was working perfectly, started to show this error message:
The controller for path ‘/Account/Login’ was not found or does not implement IController.
Then I thought: “WTF! I didn’t change anything…and most important, I don’t have any reference to a /Account/Login page”!!
After a long research, I found out that when you add “deployable dependency” and check “ASP.NET Web Pages with Razor Syntax”, it adds a reference to the WebMatrix.WebData.dll
This dll has a class with a static constructor that does the following:
FormsAuthenticationSettings.LoginUrlKey = "loginUrl";
FormsAuthenticationSettings.DefaultLoginUrl = "~/Account/Login";
So the solution is to delete the reference to the WebMatrix.WebData.dll and WebMatrix.WebData.xml and delete it from the bin folder (you must manually delete it, a “clean” on the solution won’t do it).
Just as a FYI, there is another assembly called WebMatrix.Data.dll. This doesn’t seem to cause any issues.