find a location for property in a new city

Thursday 27 May 2010

MVC2 deploy - Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.

A new MVC 2 project worked on my local machine but when it was deployed to the test server it gave the error 'Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.' I have the full Visual Studio 2010 installed on my local machine but just the .NET 4 framework installed on the test servers. It seems the MVC assemblies do not come with .NET 4 framework itself so how to make MVC 2 work on the test servers?

Update This was written for difficulties with deploying an MVC 2 app. I have written a new blog post about deploying an ASP.NET MVC 3 web application to keep you up to date with the new technologies.

When I installed Visual Studio 2010 on my local machine it came with all the fruit included (.NET4 framework, MVC2 etc) so the System.Web.Mvc.dll can be found in my machine's GAC (C:\Windows\assembly). However, since there is no need to bloat the web servers only the plain old .NET4 framework has been installed on the test servers. This does NOT include the MVC assembly and that is why it cannot be found by the web application.

You need this assembly to be on your web servers that you are deploying to but you want to avoid having to copy them into the GAC manually and doing all that gacutil mess or maybe you don't have access to your servers if they are hosted by godaddy or something.

Solution

You need to make the System.Web.Mvc assembly bin deployable... okay that doesn't sound easy but here is how to do it for the necessary MVC references:

Simply right click the reference and select 'Properties':

Then change 'Copy Local' to 'True':

Note

If your server has .NET 3.5 sp1 installed the new(ish) assemblies System.Web.Routing and System.Web.Abstractions will already be in the GAC. If you had previously deployed an MVC 1 application to a .NET 3.5 server you may remember having to deploy the other two assemblies too. Since MVC2 requires at least .NET 3.5 sp1 you will not need to worry about these assemblies, just System.Web.Mvc.

Update

There is an easier way to do this if you are using Visual Studio 2010 Service Pack 1 and using Web Deploy as your publish action when publishing. You can add deployable dependencies to your ASP.NET MVC project that will choose the necessary assemblies for you. Even easier!

Follow britishdev on Twitter

60 comments:

  1. Thanks for the explanation. I was really struggling to get my MVC 2 app deployed to IIS 6 and didn't know if the server wasn't properly configured or if it was a deployment issue.

    ReplyDelete
  2. Thanks! Deployed .net 3.5 project to GoDaddy; had to change that setting only for System.Web.Mvc.

    ReplyDelete
  3. Works great, thx

    ReplyDelete
  4. thanks for your valuable tip and was able to launch my mvc app however the images and js queries doestn seem to b working.

    i read in http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx that

    HttpContext.Current.RewritePath(Request.ApplicationPath); has to b changed to
    HttpContext.Current.RewritePath(Request.ApplicationPath, false);

    m not sure where do i change this..pls help

    ReplyDelete
  5. Looks like he's talking about the default.aspx.cs in the IIS root. It was put their by IIS itself

    ReplyDelete
  6. Tried to deploy my first ASP.NET MVC website to my VPS, got the error 'Could not load file or assembly 'System.Web.Mvc'. Oh, i thought okay lets install .NET 4.0 Standalone my server, spent my life doing that releasing then that it didnt bloody solve the problem... at which point im seriously pi**ed off

    So i turned to goggle for 'Could not load file or assembly 'System.Web.Mvc', came to britishdeveloper.co.uk (2nd in goggle by the way, before forums.asp.net), make System.Web.MVC bin deployable boom, problem solved.

    Im more annoyed that .NET 4.0 gave me the impression that it'd have MVC 2 innit.

    ReplyDelete
  7. Thank you very much!! You saved my day.

    ReplyDelete
  8. Very useful.
    Thanks

    ReplyDelete
  9. Thanks from Barcelona.
    Very useful :)

    ReplyDelete
  10. you kill my nightmares
    thank you from sheffield

    ReplyDelete
  11. Here is a full tutorial explaining how to configure server and publish MVC2 application

    http://arturito.net/2011/01/21/publishing-asp-net-mvc2-application-on-windows-server-2008-iis-7-with-visual-studio-2008-on-platform-net-3-5-sp1/

    ReplyDelete
  12. Because Aries is open-source, it is free and readily available to download. Aries has a user interface that is intuitive and easy to navigate, even for people who aren't computer whizzes.
    downloadshareitapp.com - shareit app for android

    ReplyDelete
  13. If you read a review that does not come up with any negative comment, move on, because no product is without some problems, and Top Web Hosting Reviews you need to know what they are, so that you're prepared for any glitches. Namecheap SSL coupon

    ReplyDelete
  14. It’s very informative and you are obviously very knowledgeable in this area. You have opened my eyes to varying views on this topic with interesting and solid content. affordable seo

    ReplyDelete
  15. Web application improvement at decreased expense is the key purpose behind associations to seaward their advancement work to India. Associations in Developed nations like U.S, U.K, Canada, Australia, Denmark, Sweden and so on think that its extravagant to create web
    Web Design Curriculum applications at their very own work environment due to high compensation.

    ReplyDelete
  16. Thanks for a very interesting blog. What else may I get that kind of info written in such a perfect approach? I’ve a undertaking that I am simply now operating on, and I have been at the look out for such info. Digital marketing company

    ReplyDelete
  17. I would like to say that this blog really convinced me to do it! Thanks, very good post. Zerteck

    ReplyDelete
  18. Them two turned out with their individual proposition for Hypertext frameworks and later on they joined together and offered joint proposition.Webdesign

    ReplyDelete
  19. It has fully emerged to crown Singapore's southern shores and undoubtedly placed her on the global map of residential landmarks. best web hosting

    ReplyDelete
  20. Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Thanks ecommerce website hosting

    ReplyDelete
  21. I know this is one of the most meaningful information for me. And I'm animated reading your article. But should remark on some general things, the website style is perfect; the articles are great. Thanks for the ton of tangible and attainable help. cloud hosting

    ReplyDelete
  22. I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post. מערכת ספרינקלרים

    ReplyDelete
  23. There are heaps of web designers out there.Webdesign

    ReplyDelete
  24. Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging, cheap web hosting

    ReplyDelete
  25. This comment has been removed by the author.

    ReplyDelete
  26. Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for. kvm vps

    ReplyDelete
  27. i joined so many seo forum on the internet and they are really quite helpful and i have learned a lot, website designer nyc

    ReplyDelete
  28. You could certainly see your enthusiasm in the work you write. The world hopes for more passionate writers like you who aren’t afraid to say how they believe. Always go after your heart. website designers nyc

    ReplyDelete
  29. His or her shape of unrealistic tats were initially threatening. Lindsay utilized gun first basic, whereas this girl snuck outside by printer ink dog pen. I used absolutely sure the all truly on the shade, with the tattoo can be taken from the body shape. make an own temporary tattoo new york web designs

    ReplyDelete
  30. This comment has been removed by the author.

    ReplyDelete
  31. Can I simply say exactly what a relief to get somebody who really knows what theyre referring to on the net. You definitely learn how to bring an issue to light and make it crucial. More and more people should check out this and see why side in the story. I cant think youre less popular because you certainly hold the gift. branding firms san francisco

    ReplyDelete
  32. We have a well-defined process and a dedicated team that will keep you well informed before every step we take. We make sure to get you the top quality website that result in more quality leads and sales. web development services in usa

    ReplyDelete
  33. We make sure to give you what you are looking for as we focus on stability and adaptability to engage your target market. web development services in usa

    ReplyDelete
  34. In spite of the fact that it could be a reference, you should at present read through the greatest number of audits you can discover to decide the uptime of a web facilitating organization.this contact form

    ReplyDelete
  35. To be fruitful a cutting edge brand must be a "companion" to the customer. smm panel

    ReplyDelete
  36. The data advancements have encouraged the development of upgraded mail request retailing, in which products can be requested rapidly by utilizing phones or PC systems and afterward dispatched by providers through coordinated vehicle organizations that depend broadly on PCs and correspondence advances to control their tasks. cloudways review

    ReplyDelete
  37. So, let us provide you some easy explanations on how these techniques prove to be effective in lead generation. digital marketing training in hyderabad

    ReplyDelete
  38. Wao Awesome content with helping material. Social prawn

    ReplyDelete
  39. We are Fire & Ice. Offering bespoke wedding photography. Learn More

    ReplyDelete
  40. Exercise isn't just about oxygen consuming limit and muscle size. Certainly, exercise can improve your physical wellbeing and your build, trim your waistline, improve your sexual coexistence, and even add a very long time to your life.
    However, that is not what spurs a great many people to remain dynamic. Individuals who practice normally will in general do so on the grounds that it gives them a tremendous feeling of prosperity.
    They feel more vigorous for the duration of the day
    Learn More

    ReplyDelete
  41. What are the best SEO methods to actualize on the website admin's webpage? Webdesign

    ReplyDelete
  42. I am also suffering from this problem. Now, i got the idea to resolve this issue which i face from long time. HostGator Shared Web Hosting Black Friday offers

    ReplyDelete
  43. Ensure that the site is very much audited in the substance or structure Website laten maken

    ReplyDelete
  44. In the wake of being engaged with some of these discussions, it has become truly clear that the fundamental issues are the realities that no two SEO organizations are similar and there is no bound together system.Webdesign-seo-antwerpen.be

    ReplyDelete
  45. This comment has been removed by the author.

    ReplyDelete
  46. A specialist eCommerce web specialist will have not many successfully completed dares amazingly. https://www.sandeepmehta.co.in/affordable-seo-services-delhi/

    ReplyDelete
  47. We offer Movement Therapy Sessions along with 30-minute, 60 minute and 90-minute massage sessions.
    We approach fitness through a holistic mindset with an effort to create and maintain health for mind, for body, and for life.
    NeuroKinetic therapists and Proprioceptive-Deep Tendon Reflexology practitioners focus on caring for training recovery, reducing acute
    and chronic pain, and correcting dysfunctional muscle compensations.
    Muscle compensations can be triggered through trauma, previous exercising with improper form or compensating while performing daily tasks to reduce fatigue.
    NKT and P-DTR therapies work to first identify where muscles may be abnormally behaving then help to restore them to the proper
    balance and form. More specifically, these practice target increased mobility, accelerate injury recovery, improve muscle coordination,
    improve performance for both athletes and in everyday workouts and relieves stress from routine repetition.
    Location: 5615 Dyer St. Dallas, TX 75205
    NeuroKineticTherapy
    Phone: + 1 469 487 6399
    Email: kyle.osteen@theforgeondyer.com

    ReplyDelete
  48. Ensure you ask your potential web design organization about the cycle that they use? Do they design a web webpage or do they assemble a web website?MavericksMedia

    ReplyDelete
  49. If you manage a school franchise you need to focus on how you can make the most of the business you have. Over the years, the education industry has boomed considerably in India. Hence, you need to look for how you can optimize your school presence online. Having the right business site can make a huge difference and therefore you must search for sschool website design companies that can provide you with the best designs for your school website. This would ensure that you can get the best design solutions that you need to attract students and parents alike.

    ReplyDelete
  50. Thank you for this wonderful post! It has long been extremely helpful. 메이저사이트I wish that you will carry on posting your knowledge with us.


    ReplyDelete
  51. How do virtual offices work?
    A virtual office gives businesses a physical address and office-related services without the overhead of a long lease and administrative staff. With a virtual office, employees can work from anywhere but still have things like a mailing address, phone answering services, meeting rooms, and videoconferencing.
    Virtual Office Singapore

    ReplyDelete
  52. Your Blog is very nice.
    Wish to see much more like this. Thanks for sharing your information
    also visit our site smm panel

    ReplyDelete
  53. This article gives the light in which we can observe the reality. This is very nice one and gives indepth information. Thanks for this nice article. Web Design Melbourne

    ReplyDelete
  54. VoIP or Voice over Internet Protocol refers to any communication service that uses the internet as a communications medium. In other words, it’s a way of communicating via a computer network. With the advancement in technology, the use of VoIP Service Las Vegas has become popular in recent years. Business owners use it to communicate with customers and conduct business. There are several VoIP service providers that provide quality voice services to users.

    ReplyDelete
  55. Thanks a lot, for share this awesome blog keep sharing this with us this great article. Please keey sharing such valuable information with us.
    RCB Team 2023
    IPL Schedule 2023
    Twitter CEO
    Cristiano Ronaldo Family
    Skincare Masks

    ReplyDelete