dotnet / AspNetCore.Docs

Documentation for ASP.NET Core
https://docs.microsoft.com/aspnet/core
Creative Commons Attribution 4.0 International
12.6k stars 25.29k forks source link

How to publish on Azure .NET 8 Blazor Web App with Interactive Auto on CLI? #31392

Closed MetaHex closed 9 months ago

MetaHex commented 9 months ago

Description

[Enter feedback here] Prior to dotnet 8, I can publish from cmd line using: -dotnet build -c release -dotnet publish -c release -on vscode, right click on project folder, 'Deploy of Web app..."

Since dotnet 8, this doesn't work anymore. (existing .net7 projects also doesn't work anymore)

I can publish using visual studio on VS 2022 (not preview).

Page URL

https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/?view=aspnetcore-7.0&tabs=netcore-cli

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/host-and-deploy/index.md

Document ID

c82cf121-831d-75dd-a796-c735aad3b3e9

Article author

@guardrex

github-actions[bot] commented 9 months ago

🎉🥳 Happy New Year! 💃🕺

A green dinosaur 🦖 will be along shortly to assist. Stand-by ........

guardrex commented 9 months ago

Hello @MetaHex ...

doesn't work anymore

... isn't much to go on. The command completely fails to publish the app? ... You're running the command from the main project's folder, correct?

MetaHex commented 9 months ago

I am sorry, long night! I tried this mid Nov, mid Dec, and just tried it today.

output window shows:

Starting deployment... Creating zip package... Zip package size: 1.21 GB (not sure why this size is so large for a basic project) Error: Failed to get status of deployment.

I also have issue publishing using visual studio 2022 preview. It works fine on visual studio 2022 though.

Few other information: -I don't think it's a publish issue in the sense that I can publish on vs2022, but not in cli. -I don't think it's a .net 8 issue because .net7 projects that used to be able to publish using cli no longer works either.

Looks like the tooling for vs code extension (Azure App Service) hasn't updated since "Last updated | 10/11/2023, 3:02:01 PM". "dotnet publish -c release" should be pretty common command so I am not sure why this isn't working out of the box. I wonder if this is something limited to my environment or it's common. From few online forums, seems a consistent issue. I could try to dig more later, like compare the release between vs2022 vs cli.

The ask is to have a guidelines/documentation to be able to publish using cli.

Alienroid commented 9 months ago

I also ran cli on mac/apple si. Let me try windows in a bit

guardrex commented 9 months ago

I'm not sure which team can accept a CLI - Azure App Service bug report. Normally, the SDK team handles the CLI, but I don't think that they can help with an Azure CLI problem.

This error ...

Failed to get status of deployment.

... AFAIK is along the lines of the CLI failing to interact with Azure correctly.

@Rick-Anderson ... which team can assist with a CLI bug report for Azure App Service?

MetaHex commented 9 months ago

Confirmed also fails on Windows.

SDK 8.0.100.

It is non-blocking issue because I can use visual studio to publish. It's just inconvenient that I have to switch box and open vs for publish. Also, the strange behavior that I have to keep multiple versions of vs 2022 (as publish doesn't work on the preview).

Others have success publish directly from github. (I haven't tried this)

On documentation side. On dotnet 7, we had guide for hosted wasm. That went away on dotnet 8. I wonder if we can have some insight on why. Is it because msft think blazor server side, blazor interactive auto are all blazor web app?

guardrex commented 9 months ago

Yes on that question about dropping hosted WASM coverage. Management prefers to move forward with only BWAs and standalone Blazor WebAssembly. For something similar to hosted WASM, one would create a global interactive WebAssembly app, possibly with prerendering disabled if the dev wants nothing to do with server processing.

On the right team to contact about the CLI publishing problem, we'll have to wait and see if @Rick-Anderson has the latest contact for a problem like that. I would think that there's an Azure PU (not Azure docs) GH repo that can handle the issue.

MetaHex commented 9 months ago

Thanks Luke, I just wanted to bring this to attention as it's been few months and seems no one reported (except on few online forums/stackoverflow/discords)

Get Outlook for iOShttps://aka.ms/o0ukef


From: Luke Latham @.> Sent: Tuesday, January 9, 2024 10:25:09 AM To: dotnet/AspNetCore.Docs @.> Cc: MetaHex @.>; Mention @.> Subject: Re: [dotnet/AspNetCore.Docs] How to publish on Azure .NET 8 Blazor Web App with Interactive Auto on CLI? (Issue #31392)

Yes on that question about dropping hosted WASM coverage. Management prefers to move forward with only BWAs and standalone Blazor WebAssembly. For something similar to hosted WASM, one would create a global interactive WebAssembly app, possibly with prerendering disabled if the dev wants nothing to do with server processing.

On the right team to contact about the CLI publishing problem, we'll have to wait and see if @Rick-Andersonhttps://github.com/Rick-Anderson has the latest contact for a problem like that. I would think that there's an Azure PU (not Azure docs) GH repo that can handle the issue.

— Reply to this email directly, view it on GitHubhttps://github.com/dotnet/AspNetCore.Docs/issues/31392#issuecomment-1883567726, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWOI5HNRWTWCSVAQW2IIN23YNWDQLAVCNFSM6AAAAABBTL2KEGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBTGU3DONZSGY. You are receiving this because you were mentioned.Message ID: @.***>

guardrex commented 9 months ago

Let me have you open the report for the PU and let them get you to the right spot.

I recommend asking them directly which team a CLI-Azure publish problem should be reported to or ask them if they'll move your issue to the correct GH repo. They don't work on the CLI or directly on Azure and that error looks like some kind of Azure auth problem. They won't be able to help directly, but they should be able to get you to the right spot.

https://github.com/dotnet/aspnetcore/issues

Please add ...

cc: @guardrex https://github.com/dotnet/AspNetCore.Docs/issues/31392

... to the bottom of your opening comment so that I can follow along and see how this plays out.

MetaHex commented 8 months ago

Just want to keep you updated:

For anyone else running into this issue deploying. I think the following happened:

When deploying using vscode, azure extension, the deployment is trying to use deploy with git (local or github or azure devops...). In the past, we could build, publish locally and deploy only the zip from zipdeploy. For some reason, when we publish now (some time after net7), we still do build, publish locally and deploy. But on server, it will still try to compile from git on the server. Meaning, the zipdeploy will need the full git instead of the trimmed. This results that the zip will be very large in size. As a reference, a default app scaffold from "dotnet new blazor -o BlazorApp", the zip generated on mac is 1.2GB and on windows 300+MB. Deployment might fail due to size being too large.

tldr; a workaround: using zipdeploy: https://learn.microsoft.com/en-us/azure/app-service/deploy-zip?view=azure-devops&tabs=cli#create-a-project-zip-package

Step 1: add web.confg at root of project if you don't have one:

Step 2: build and publish release dotnet build -c release dotnet publish -c release

Step 3: generate zipdeploy -go to bin\release.net8\publish and run the following based on Bash or PowerShell

Bash zip -r .zip .

PowerShell Compress-Archive -Path * -DestinationPath .zip

Step 4: In the browser, navigate to https://.scm.azurewebsites.net/ZipDeployUI.

Upload the ZIP package you created in Create a project ZIP package by dragging it to the file explorer area on the web page.