Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle wwwroot into executable #332

Open
IvanJosipovic opened this issue Feb 24, 2021 · 5 comments
Open

Bundle wwwroot into executable #332

IvanJosipovic opened this issue Feb 24, 2021 · 5 comments
Labels
area-mobileblazorbindings Experimental Mobile Bindings for Blazor hybrid-apps Issues related to hybrid or web/HTML apps

Comments

@IvanJosipovic
Copy link

Currently when publishing a Windows based Hybrid Blazor App, it will publish the executable and the wwwroot folder.
Are there any plans to support embedding the wwwroot into the executable?

image

@Eilon
Copy link
Member

Eilon commented Feb 25, 2021

Hi @IvanJosipovic the location of static files currently depends on the platform. They go into a different location depending on whether it's Windows, macOS, iOS, or Android, in part due to limitations of those platforms. Static files on disk tend to be the simplest approach because the files start out as static files on disk, so it's a bit easier to load them. With embedded resources we have to deal with differences in how filenames/folders are stored, so you end up needing additional manifest files and other complexities.

Long story short: It's definitely a nice idea, and something worth investigating in the future.

In the meantime if you could share info about why you're looking to change this, that would help guide the priority of this issue.

@Eilon Eilon added area-mobileblazorbindings Experimental Mobile Bindings for Blazor hybrid-apps Issues related to hybrid or web/HTML apps labels Feb 25, 2021
@IvanJosipovic
Copy link
Author

Thanks for the response @Eilon.
I see this suggestion being useful in the Windows/macOS targets only and primarily helping with aesthetics.

Benefits of embedding:

  • Easier portability, less fragile
  • Shipping a single binary is cleaner
  • Hides internal resources
  • Makes it harder to alter internal resources

@Eilon
Copy link
Member

Eilon commented Feb 25, 2021

Sure, these all seem reasonable. I think for many apps this would be largely solved by using an installer, for example an MSI, or going through an app store experience such as Windows Store or Apple App Store. Many apps will likely still be multi-file, but it might be nice to reduce some loose files.

@dcuccia
Copy link

dcuccia commented Feb 25, 2021

I can second the single file use case - I am building portable no-install single file desktop apps and evaluating Blazor as the UI layer.

@shaun-wilson
Copy link

Has there been any progress on this request? It seems not as I have just been trying out Blazor Hybrid with WPF on .NET 8 RC1 and cannot find any combination of settings that bundles the wwwroot in the exe. Using dotnet publish along with the following settings in csproj gives a small exe (~2.5MB), but with the wwwroot folder/files beside it.

<PublishSingleFile>true</PublishSingleFile>
<SelfContained>false</SelfContained>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

I just want to make a single exe that can be run without install or unpack - ie a portable program. In searching for a solution to this problem, I came across other users with the same desire;

  1. https://stackoverflow.com/questions/72433132/asp-net-core-blazor-hybrid-as-single-file-application
  2. https://old.reddit.com/r/Blazor/comments/m6z8dk/blazor_webassembly_hosted_is_it_possible_to_pack/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mobileblazorbindings Experimental Mobile Bindings for Blazor hybrid-apps Issues related to hybrid or web/HTML apps
Projects
None yet
Development

No branches or pull requests

4 participants