Giter Club home page Giter Club logo

Comments (5)

jeromelaban avatar jeromelaban commented on May 27, 2024 3

Thanks for the suggestion. At this point, there is no sample on how to do that, but if StaticWebAsset is supported in the default Web SDK, then it should not be a big deal to add.

If you be added in the publish targets:

BeforeTargets="GetCopyToPublishDirectoryItems"

or after the build dist target:

<Target Name="BuildDist" AfterTargets="AfterBuild">

from uno.wasm.bootstrap.

FrancoisM avatar FrancoisM commented on May 27, 2024 1
<Project>
	<Target Name="CopyingDistToAspNetWwwRoot" AfterTargets="BuildDist">
		<ItemGroup>
			<DistFiles Include="$(OutputPath)dist\**\*.*" />
		</ItemGroup>		
		<Copy SourceFiles="@(DistFiles)"
			  DestinationFolder="..\..\MyApp.WebApp\wwwroot\wasm\%(RecursiveDir)" SkipUnchangedFiles="true"/>
	</Target>	
</Project>

from uno.wasm.bootstrap.

FrancoisM avatar FrancoisM commented on May 27, 2024

Hello.
Did you manage to do it? Any sample to share?
Right now I think that in my CI I'll copy the wasm dist folder to the wwwroot of the aspnetcore.

from uno.wasm.bootstrap.

mmarinchenko avatar mmarinchenko commented on May 27, 2024

@FrancoisM

  1. You may just set WasmShellDistPath to ..\..\MyApp.WebApp\wwwroot\wasm to achieve the same effect (unless you need to save a copy inside $(OutputPath)dist).

  2. You probably should change WebRootPath to \wwwroot\wasm in your ASP.NET Core hosting configuration or pass this path to UseStaticFiles()/UseSpaStaticFiles() to correctly serve http[s]:\\host:[port]\wasm\* requests.

from uno.wasm.bootstrap.

mmarinchenko avatar mmarinchenko commented on May 27, 2024

Alternatively, you can put Uno wasm app directly in wwwroot folder. Here's what it might looks like in a Dockerfile:

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
ENV ASPNETCORE_URLS=https://+:443;http://+:80
EXPOSE 443 80
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
COPY . /src
RUN dotnet build "/src/Server/Host/Host.csproj" -c Release -o /app/build
RUN dotnet build "/src/Client/Wasm/Wasm.csproj" -c Release -p:WasmShellDistPath=/app/build/wwwroot

FROM build AS publish
RUN dotnet publish "/src/Server/Host/Host.csproj" -c Release -r linux-x64 -o /app/publish --self-contained=false
RUN dotnet publish "/src/Client/Wasm/Wasm.csproj" -c Release -r browser-wasm -p:WasmShellDistPath=/app/publish/wwwroot --self-contained=false
RUN find /app/publish -type f -name '*.pdb' -delete

FROM base AS final
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Server.Host.dll"]

P.S. I'm using .NET 5.0 in my project for now. I haven't tried 6.0 yet, so things might be different there.

from uno.wasm.bootstrap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.