C
C#2y ago
Isotop7

❔ Blazor web app in console

Hi, I currently write a small project that utilizes a console application on my server, thats running several tasks in the backend. One of these tasks is listening on mqtt messages and putting them in a database. Now I want to extend this project with a web app to run CRUD operations on the database. I want the blazor page to be spawned in my main program.cs thats already spawning all other tasks. Do I need to create a separate repo for this? Is there any other alternative as this would lead to duplicated code (DbContext, Models, etc.)
6 Replies
TheRanger
TheRanger2y ago
u mean u want to display the blazor page in the console window?
Isotop7
Isotop7OP2y ago
No, i want to build a separate blazor web app, thats using code from my existing console application like DbContext and it should be started from my Program.cs from my console application. When I create a new template with dotnet the template uses the asp.net sdk and I don't really know how to incorporate it. I want to ship my main application, thats spawning several tasks with the web ui using blazor in one exe Like: MainApp -> Program.cs: -> Spawn Task A -> Spawn Task B -> Spawn Blazor Web App -> Spawn Task C
anita
anita2y ago
Just change the the sdk to the .web one, like you see in the blazor csproj template. Then you can start the blazor app whenever you want.
Isotop7
Isotop7OP2y ago
has this any downsides for my console application?
anita
anita2y ago
No, not really. It will increase in size a bit, because some extra web dependencies are added. But other than that, no.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server