dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
34.84k stars 9.84k forks source link

Question: How to detect whether the current app is a normal ASP.NET Core application or a Blazor app? #56633

Closed zhiyuanliang-ms closed 3 days ago

zhiyuanliang-ms commented 5 days ago

Knowing the approximate proportion of different kinds of ASP.NET applications out of all customers could be helpful for us.

May I ask some instruction or advice on how to detech whether the current application is a Blazor app(Blazor server app or webassembly) or not?

javiercn commented 4 days ago

@zhiyuanliang-ms thanks for contacting us.

There's no way for you to do this at runtime from outside the application. At compile time you can look at the project files and SDKs being referenced by csproj files to determine if the app includes components (.razor files) or references webassembly, but in general, there's no fool proof method to do this, as an app can contain server, webassembly, and non blazor UI.

dotnet-policy-service[bot] commented 3 days ago

This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.

See our Issue Management Policies for more information.