3
votes

I'm trying to deploy the contents of a dotnet project after running dotnet publish, but the newer versions of azure-cli complain with the following error message:

$ az webapp up --name MyAppService
Could not auto-detect the runtime stack of your app, see 'https://go.microsoft.com/fwlink/?linkid=2109470' for more information

Following the link, https://go.microsoft.com/fwlink/?linkid=2109470, I can see that it's looking for a *.csproj file, but that doesn't make sense to me, since I'm deploying files from my publish directory. From what I can see, if I run it from the directory that contains a *.csproj file it works, but tries to zip and upload all the source code and not just the published files.

It originally worked in azure-cli v2.0.66. Recently I downgraded to v2.0.75 (as indicated here https://stackoverflow.com/a/59529584) and it works also, but I would like to keep azure-cli up to date. I've also seen that the azure-cli has added an --html flag to deploy static files, but my situation is a bit different.

So the question is: How do I get az webapp up to work from the dotnet publish directory in versions of azure-cli >v2.0.75?

3
If you copy the csproj to the directory it works for me. – - Peter Siebke

3 Answers

1
votes

I think that there is some related bug.

I had a similar issue. Following this tutorial the final step was apply the az webapp up command but the deployed site only had a message saying "You do not have permission to view this directory or page". That means that no site was detected on the deployed site folder.

I applied the dotnet publish command and tried to run az webapp run from the published folder but the result was the same as you: "Could not auto-detect the runtime stack of your app, see 'https://go.microsoft.com/fwlink/?linkid=2109470' for more information."

Finally, from the root project folder I ran dotnet publish -o . and then az webapp up and got the deployment working as expected. This sounds really crazy because I finally got merged the published files with the source code.

This is my first attemp to use az webapp up, I hope that this issue to be solved soon.

0
votes

Try to upgrade the CLI version to 2.0.79 and see if that helps. We recently had issues with Az webapp up and this was fixed by 2.0.79 version.

Please take a look at this thread for more info : Github Issue

Also this doc for more reference : Create a static web app in Azure

0
votes

Try executing the following command from your project directory (where you have your .csproj file):

dotnet publish

Then execute the following command from your publish directory (where you have the output files generated by the previous dotnet publish command):

az webapp up --name <AppServiceName> --runtime <desired_runtime> --os-type <Windows|Linux>

Note: you can check the list of available runtimes with az webapp list-runtimes

If the az webapp up command fails, check in your Azure Web Portal for your App Service if you have the following Application Settings parameter:

SCM_DO_BUILD_DURING_DEPLOYMENT

If it is present, set its value to False, make sure to Save its new value, and then try again the az webapp up complete command.