找到你要的答案

Q:Unable to deploy RazorEngine to Azure

Q:无法部署razorengine 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?

我用razorengine MVC应用程序。我的应用程序部署到Azure但是当我试图执行的方法razorengine,我收到以下错误:

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.

我得到它的工作由当地安装在GAC。我已复制本地设置为TRUE的参考。我也有system.web.razor作为参考。

有没有人成功地在Azure上得到正确的工作?

answer1: 回答1:

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

我假设你在Azure中做了一个源代码控制部署?

如果是这样,那么相当注重使用NuGet带来所有这些种类的依赖在一起的需要。这就是ASP.NET vnext是标题,所以你以后会感谢我的。

所以你的第一步是非基准你基于GAC组件。下一步,然后你从NuGet安装一。

Install-Package RazorEngine -Version 3.7.0

http:/ / www.nuget。org /包/ RazorEngine / 3.7.0

azure  razorengine