Suchiman / BlazorDualMode

Demo on how to run dynamically in client or server side mode
MIT License
145 stars 24 forks source link

Where is index.html after publish? #15

Closed vanderstack closed 4 years ago

vanderstack commented 4 years ago

When I run the publish command the output does not include the index.html file required to deploy the project in client-only mode to a static-file web host such as github pages.

Command Used: dotnet publish -c Release

Expected Output Directory: bin\release\net***\publish\wwwroot\

Suchiman commented 4 years ago

Dual mode uses the https://github.com/Suchiman/BlazorDualMode/blob/master/BlazorDualMode.Server/Pages/_Host.cshtml file because index.html does not work for server mode. You could have both an index.html and an _Host.cshtml which you'd need to keep in sync.

vanderstack commented 4 years ago

Thank you for the explanation and suggestion. I may attempt something like this and will update if it goes well.

vanderstack commented 4 years ago

Adding the index.html file did allow me to publish and serve the client project from a static http server, however doing this broke the FetchData tab because /api/SampleData/WeatherForecasts/ is no longer being served by the Server Host.

vanderstack commented 4 years ago

Comparing with my standalone WebAssembly application it seems the difference is that the standalone loads the data from a json file rather than from a .net core hosted controller, and so this endpoint not working should be expected.

vanderstack commented 4 years ago

I wanted to follow up in case anyone else is interested in doing the same.

I've upgraded this project to support deploying just the client in this commit: https://github.com/vanderstack/BlazorDualMode/commit/8f974033722f9995764793b164e5877d760e477c

I've gone further and integrated BlazorWebView to add a WPF host to run natively on windows (mac and others are also available using other projects in the BlazorWebView library), and then included the latest Test Suite prototypes from Steve Sandersons blog.

A stable commit with these features is available here: https://github.com/vanderstack/BlazorDualMode/commit/d58dbe5a499aaa9cd3a519f4af07e9a8e18036d8