Razor icon indicating copy to clipboard operation
Razor copied to clipboard

Razor view compilation in standalone app for emails

Open Ryujose opened this issue 8 years ago • 6 comments

Hello community.

I want to compile razor views in an standalone app that contains those views.

What I need to compile those views like when we're working with MVC to see if there's is any issue and prompt it (The use of MvcBuildViews to be more precise), to ensure there isn't any surprise on the email templates?

Regards.

Ryujose avatar Sep 28 '18 15:09 Ryujose

Thanks for contacting us, @Ryujose. Can you please provide more details about your scenario? What version of SDK are you targeting? What is the project type? All the razor views in a ASP.NET Core web app project will be compiled during build (from 2.1 on) automatically.

mkArtakMSFT avatar Sep 28 '18 16:09 mkArtakMSFT

Also see See https://github.com/aspnet/Entropy/tree/master/samples/Mvc.RenderViewToString and past discussions - https://github.com/aspnet/Mvc/issues/4884, https://github.com/aspnet/Razor/issues/2274

pranavkm avatar Sep 28 '18 17:09 pranavkm

Sure! I'll detail it bellow.

Project type: Console App Platform: .NET Framework 4.5.2

Current project references:

  • Microsoft.ApsNet.Razor v3.0.0
  • RazorEngine v3.9.1

Thanks in advance!

Ryujose avatar Sep 28 '18 17:09 Ryujose

@pranavkm the first link seems broken with 404 error (https://github.com/aspnet/Entropy/tree/dev/samples/Mvc.RenderViewToString).

Ryujose avatar Sep 28 '18 17:09 Ryujose

Updated it

pranavkm avatar Sep 28 '18 17:09 pranavkm

@Ryujose, it seems you're referencing some third party library (RazorEngine), which is nothing we support or are aware of. Unfortunately we won't be able to help you with this. Try the StackOverflow - as you may better community for this particular question in there.

mkArtakMSFT avatar Sep 28 '18 18:09 mkArtakMSFT