-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Avoid 'dist' subdirectory in published artifacts (requires changing UseBlazor middleware) #5493
Comments
I think you're right that we could avoid the As for the other artifacts:
I'll rename this issue to just "remove the 'dist' subdirectory" and leave it open on the backlog. |
I added a note (Redirects for correct routing) to our tracking issue for the Host and deploy topic to make sure it's covered: dotnet/AspNetCore.Docs#5771
I see. I naively thought each project is published to its own bin folder, thus published to its own publish folder (per config). I take away from this that in the hosted project scenario that there's one project (one bin; one publish per config) that contains a single hosting app and one or more client apps. I linked this to our high level planning Wiki so that this will be covered in the Blazor directory structure topic. |
Just adding a note here for future discussion of serverless Azure CDN hosting. In addition to the lack of redirect capabilities at the moment for anything other than a Premium Azure CDN endpoint, there's another smaller problem with the directory structure of a published Blazor app: Without a completely flat directory structure, deployment to Azure CDN's [EDIT] [EDIT] Was going to attempt to move assets, such as the |
Azure Storage / Azure CDN for a completely serverless hosting setupI have the standalone template app running on Azure Storage (and I think it will run on the Azure CDN in this configuration), but it took some hacks: OPTION 1
OPTION 2
OPTION 3Very hacked to demo a completely flat deployment. asm.js is dropped and bootstrap fonts aren't referenced properly for this dirty hack ...
No rewriting ... client-side routing onlyYou'll need to wait on the upcoming Azure Storage/CDN rewriting feature or go without address bar routing. Alternatively, the Premium Verizon CDN offers the Rules Engine that has a rewrite feature (might be $$$ ... idk). If there was a completely flat publish option, it would have been possible to host in Please reconsider the extra folder in the standalone publish scenarioIn the hosted Blazor app scenario, I do understand the need to publish Blazor apps in their own folders in the published output. I hope you'll reconsider tho for the standalone case. I still think that a single standalone app deployment doesn't need to be further nested inside another folder. |
I suspect if you set the base href to /app/ (with trailing slash) then you wouldn’t need to modify the other files to put in any prefixes there. |
I tried it ... Using
... but internal routing 💥. I'll play with it a bit more. [EDIT] [EDIT v2] Yes 👍 ... got it working ... I needed to add it to the nav links, e.g., ... <li>
<NavLink href="/app/counter">
<span class='glyphicon glyphicon-education'></span> APP Counter
</NavLink>
</li> |
@SteveSandersonMS Thanks ... I added an "Option 2" ☝️ with that approach, which is definitely better because it eliminates having to mess around inside the However, to get rid of the [EDIT] I made a nasty hack to make it run with a flat directory structure from |
@SteveSandersonMS is there any action pending here? |
@mkArtakMSFT @SteveSandersonMS Because I ❤️ this concept so much, I'd like to make a final pitch for it: If a flat publish directory structure option doesn't become an option, there's no opportunity to host a client-side Blazor (Razor Components) app on the Azure Storage CDN (at the root). This has perhaps been considered and rejected by management. I just wanted one last shot at suggesting it here because the client-side Blazor (Razor Components) app on the Azure CDN (Look ma! ... NO SERVER!) approach 🎷 ROCKS! 🎸 conceptually. Thanks for hearing me out. |
It's good feedback, but not something we have plans to handle currently. Realistic apps just aren't going to be a flat list of files, because the moment you bring in 3rd-party JS libraries or nontrivial amounts of static content, it's going to be in a directory hierarchy for certain, and that hierarchy must be reflected in the deployment otherwise it will fail at runtime. We can't somehow rewrite 3rd-party JS libraries to change their internal expectations about where content should be loaded from. Since I don't see any way beyond this, and we have considered it at length, I'll mark it closed. But @guardrex / @mkArtakMSFT / @danroth27, if you think this needs further consideration or I've missed something, please reopen or let me know! |
Doesn't have to be that way tho in many cases. The obvious problem is file name conflicts. I don't understand how any other problems with 3rd party JS or static assets could be an issue.
I don't have your knowledge and experience with that, so I'll take your word for that. If you say that's a problem, I believe you. Client-side Blazor (Razor Components) on Azure CDN (at the root) is a gorgeous hosting scenario. Hosting outside of Thanks for considering it. The alternative is that |
On publish, the assets are going into a folder with the same name as the app and web.config sits at the root of publish with rewrite rules to serve from {app_name}/dist.
... but I was expecting a much flatter structure akin to what has been done with ASP.NET Core ... something along the lines of ...
I have the notion that dist is a holdover from other frameworks. Having the app name in the mix seems strange. Just wondering why it was setup this way?
Would it be an improvement to use the flatter structure (following the ASP.NET Core publishing philosophy these days)? The structure is simpler and the rewrite rules can be dropped. There might be an additional reason to use the flatter structure: My understanding was that the web.config was placed into a flat structure in ASP.NET Core because it allows publishing of multiple apps with WebDeploy. cc/ @shirhatti
The text was updated successfully, but these errors were encountered: