Search code examples
azurerazorengine

Unable to deploy RazorEngine to Azure


I have an MVC app using RazorEngine. I've deployed the app to Azure but when I attempt to execute the method using RazorEngine, I get the following error:

Could not load file or assembly 'RazorEngine, Version=3.7.0.0, Culture=neutral, PublicKeyToken=9ee697374c7e744a' or one of its dependencies. The system cannot find the file specified.

I got it to work locally by installing it in the GAC. I have Copy Local set to true on the reference. I also have System.Web.Razor as a reference.

Has anyone been successful in getting this working correctly on Azure?


Solution

  • I am going to assume that you are doing a source code control deployment in Azure?

    If so, then rather focus on the need of utilising NuGet to bring all these kinds of dependencies together. This is where the ASP.NET vNext is heading, so you will thank me later.

    So your first step is to unreference your GAC based assembly. Next, you will then install the one from NuGet.

    Install-Package RazorEngine -Version 3.7.0
    

    https://www.nuget.org/packages/RazorEngine/3.7.0