-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Razor Precompilation #3917
Comments
@pranavkm I took a look at the EmbeddedFileProvider and it seems like a reasonable alternative. I really don't care about razor precompilation as long as I can package views ( cshtml embedded file ) into a nuget class library package. The new dotnet cli can handle this now using the "resources" property - correct? |
@ToddThomson , yes. There's a bunch of discussion around using this pattern here - #3750 |
@pranavkm OK. Using CompositeFileProvider with multiple EmbeddedFileProvider instances provides me with what I need. I had built a dynamic module view provider over the base PrecompiledViewProvider, but this may work out better. Thanks for your help. |
Moving to backlog. |
Is there no way to spot a syntax error or a typo at compile time anymore? |
@rstarkov, you might be able to create a executable around |
Anyone have an estimate of when this will be prioritized for a specific release? |
@Zachary1748 we have @rynowak working on a new implementation of Razor precompilation with @DamianEdwards . @rynowak @pranavkm should we do anything with this bug? Is the new stuff related in any way to the old stuff? |
Updating the top-post |
Main post updated |
I've put together something to get us by until an official solution arrives: https://github.com/tuespetre/dotnet-precompile-views I'm really sad they removed the |
@tuespetre I tried messing around with CCI to do this - https://github.com/aspnet/Mvc/pull/5087/files#diff-8a8d40881a0fbe5921c1000c1f6016edR72. Unfortunately it has issues (CCI can't strong name assemblies) and it's in support mode so we're considering not doing this. Mono.Cecil supports strong naming but the package hasn't hit 1.0 as yet and doesn't support netstandard TFMs. |
Done? |
Not really. Need to check in the other piece. |
Ok 😄 |
First iteration done: aspnet/MvcPrecompilation@dbe93ac. Second pass includes addressing naming \ design for view discovery components in Mvc, adding more sample \ test scenarios, and performance. |
So it's not done, but the Done label is added and the issue is closed? And the link @pranavkm posted leads to a 404. |
@MartinJohns we hadn't set up some of non-code aspects on the repo (licensing \ README, CLA bot etc) as yet. We'll get it made non-private once that's done, which should be very soon. |
@MartinJohns - repo is public now - https://github.com/aspnet/MvcPrecompilation. |
Summary
We want to bring back Razor Precompilation so that you can ship an assembly or app with views baked in. We're going to start developing this during the 1.1.0 timeframe based on a prototype from https://github.com/aspnet/Performance/tree/dev/testapp/RazorCodeGenerator
Goals:
Non-Goals:
Details
Our plan is to implement precompilation via a command line tool. We have an existing tool that can generate
.cs
files given a project - we need to make that tool production quality and then add the ability to compile the generated code and embed it as a resource in the application assembly.We'll also add support to the view engine to detect and use embedded view assemblies automatically via application parts. This means that dependencies you reference can include precompiled views.
The biggest unknown here is how exactly we'll interface with your application's startup code path when you've configured Razor to include extra application parts or references. We need to start productionizing what we have and look at gaps.
The text was updated successfully, but these errors were encountered: