Hello all,
Background:
I'm writing an application that in some cases will have an Blazor UI.
Due to this I want to deliver the Blazor UI part as a plug-in. I already have a few plug-ins that are non UI and that works fine.
Since I'm a newbie when it comes to Blazor the question is probably fairly trivial.
Consider the "out of the box" Blazor demo application from VS. It has the counter and the weather. It works nicely.
What if I would like to compile the demo program as an assembly instead of the default Console application and then have another Console application starting it?
Should be trivial enough, or?
I've learned by trial and error that the second (Console starter app) needs to have the project configured as this
<pre><Project Sdk="Microsoft.NET.Sdk.Web">
instead of the regular
<pre><Project Sdk="Microsoft.NET.Sdk">
in order to work.
However the web contents look awful (since I assume that the wwwroot etc. is not found) and I've tried different ways of setting the some folder to where the web root and pages are but I have failed.
My question is:
What do I need to do to make a secondary console application execute my Blazor application (now compiled as an assembly) and make it look and behave just as it normally would if it was started directly?
What I have tried:
I've tried
var builder = WebApplication.CreateBuilder(new WebApplicationOptions
{
ContentRootPath = @"c:\path_to_where_my_contents_is"
});
but this does not seem to make a difference.