dotnet / razor

Compiler and tooling experience for Razor ASP.NET Core apps in Visual Studio, Visual Studio for Mac, and VS Code.
https://asp.net
MIT License
506 stars 195 forks source link

Blazor server app slow build time #10616

Open kuldipmis opened 4 months ago

kuldipmis commented 4 months ago

Hi,

As the title suggests we are working on a Blazor Server App with .net 8 and we are seeing quite slow build times. We are migrating a legacy application (.net framework 4.8) to Blazor and its expected that the project will hit close to (if not exceed) 5000 components (both routable and non-routable).

At the moment we are seeing local build times of around 1 minute 30 seconds with around 1200 components (Routable and non), I cannot make the code for this available as it contains company IP so I have prepared a sample application which can be found at Repo the average build time of this application is around 20 - 30 seconds. We have also prepared both bin and comp logs for the build process to help diagnose what the potential issue could be.

I also wanted to mention that we have a dependency on Telerik UI controls for Blazor, just by adding this package to the project (not using any of the controls) inflates the build time by an average of between 30% - 40%

Any insight into why the process is taking so long would be useful as the more we migrate into the Blazor re-write the slower its going to get.

As a side note hot reload is also an issue, it doesn't seem to be working for the new project

javiercn commented 4 months ago

@kuldipmis thanks for contacting us.

Based on the log, you provided seems that compilation is taking the vast majority of the time.

image

Moving this to the Razor repo so that they can evaluate it.

As an aside, if you file an issue through the report a problem dialog here it will collect all the relevant logs and information from Visual Studio to help the team diagnose and troubleshoot the issue.

kuldipmis commented 4 months ago

Hi @javiercn - Sorry, I should have mentioned that I did look at the bin log and identified that the majority of the time taken was in csc.exe. Thanks for the input and redirection of this issue to the relevant team