question

Richard-5308 avatar image
0 Votes"
Richard-5308 asked Bruce-SqlWork commented

Is there dynamic compilation in ASP.NET Core 5 Razor Pages

We currently have a large website using asp.net webforms framework 4 C# and it was easy and quick to upload a single modified cs file to production server because of asp.net's dynamic compilation. Is there dynamic compilation for ASP.NET Core 5 Razor Pages as I don't see it in the MS document?

We don't want to recompile the whole website files as it results in a long compile time which in turn results in a very large dll which in turn takes forever to upload to production server. Any solution is welcome.

dotnet-aspnet-core-razor
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Richard-5308,

About the cs file, whether it is a class or razor page's cshtml.cs file? Can you explain more detail about how to modify the cs file? Based on my experience, by using the Razor file compilation in ASP.NET Core, we could change the razor file content without recompile the whole website, but if we create new model or change the exist class's property, an error might occur during the compilation. So, I suggest you could deploy the website use two separate deployment slots (like the staging environments in Azure App Service), one for production and another is the staging environment. Then, you can swap deployment slots to update the application.

0 Votes 0 ·
Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Richard-5308 avatar image
0 Votes"
Richard-5308 answered

@Bruce-SqlWork The doc doesn't say how to avoid compiling the whole website when a single file with the extension .cs is modified.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered

Old asp.net used app domains to host the web application, and each view was compiled to an individual dll, that was dynamically loaded. After a set number of recompiles a new domain was created, and the old domain unloaded.

For startup performance, view recompile was added.

.net core does not support app domains. And was designed for view precompile at the start. Currently there is no support for individual view recompile, it’s always the whole site.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

sreejukg avatar image
0 Votes"
sreejukg answered Bruce-SqlWork commented
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

yes, there is runtime compilation, but unlike asp.net 4.*, it recompiles the whole site, not just the replacement page. the question was about individual page compilation.

0 Votes 0 ·