WebWindow icon indicating copy to clipboard operation
WebWindow copied to clipboard

PublishSingleFile, including wwwroot?

Open dcuccia opened this issue 5 years ago • 4 comments

Hi! Would it be feasible to make the web assets an embedded resource and extract on first load? Or even mimic a virtual file system to the browser? Interested in .Net Core single-file publishing for copy-paste portable desktop apps.

dcuccia avatar Dec 15 '19 23:12 dcuccia

Check out my suggestion in #14

sondreb avatar Dec 31 '19 16:12 sondreb

@sondreb your suggestion work for the sample with vue.js but the problem seems that with WebWindow.Blazor when you publish singlefile you get the wwwroot on the side On mac this is the result: image

GitMyCode avatar Feb 23 '20 21:02 GitMyCode

So okey i made it work with the sample in the .csproj i added ExcludeFromSingleFile="false" for the wwwroot

<ItemGroup>
   <Content Update="wwwroot\**" ExcludeFromSingleFile="false">
     <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
   </Content>
 </ItemGroup>

and of course in the Program.cs

var executingDir = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
ComponentsDesktop.Run<Startup>("My Blazor App", Path.Combine(executingDir,"wwwroot/index.html"));

so now when i publish dotnet publish -r osx-x64 -c release /p:PublishSingleFile=true i get a single executable file and when the content is extracted in the tmp directory i see the wwwroot

image

GitMyCode avatar Feb 23 '20 22:02 GitMyCode

Heads up, you need to be on .Net Core 3.1.200-preview-014977 for ExcludeFromSingleFile="false" to work.

IvanJosipovic avatar Mar 01 '20 00:03 IvanJosipovic