Eyal Zinder
Eyal Zinder

Reputation: 664

Class Library on Azure VM

I'm trying to deploy an MVC 5 website to Azure VM, which contains custom domain logic in a separate DLL (C# Class Library). The application is super simple.. MVC Website calls a single object from the library, which returns a string and displays it in the view.

When I publish the website, I get the following error:

Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=[removed]' or one of its dependencies. The system cannot find the file specified.

What am I required to do in order to use a custom DOM in my MVC Applications if I plan on deploying to Azure? Secondly, will I need to do the same for other 3rd party libraries such as MongoDB, NinJect DLLs?

Upvotes: 0

Views: 142

Answers (1)

pollirrata
pollirrata

Reputation: 5286

This error will happen for all the assemblies that are not GAC'ed

You need to

  • On Visual Studio, go to your references list
  • Select the assembly
  • Right click > Properties
  • Set the “Copy Local” value to true

Repeat for each assembly that is not GAC'ed and your project depends on, most likely

Microsoft.Web.Infrastructure
System.Web.Helpers
System.Web.Mvc
System.Web.Razor
System.Web.WebPages
System.Web.WebPages.Deployment
System.Web.WebPages.Razor

Upvotes: 1

Related Questions