Search code examples
botframeworkazure-cliazure-bot-servicekuduazure-appservice

Can't deploy Asp.Net Core SDK 4 BOT using CLI instructions


The BOT works, but I can't deploy it to Azure using the CLI instructions here.

https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-deploy-az-cli?view=azure-bot-service-4.0&tabs=csharp#option-1-existing-app-service-plan

Here are my relevant CLI commands.

az bot prepare-deploy --lang Csharp --code-dir "./Source/Repos/MyBot.Bot/MyBot.Bot" --proj-file-path "C:\Users<username>\Source\Repos\MyBot.Bot\MyBot.Bot\MyBot.Bot.csproj"

az webapp deployment source config-zip --resource-group "BOTQnARG" --name "MYBOTAPP" --src "C:\Users<username>\Source\Repos\MyBot.Bot\MyBot.Bot\Data.zip" --timeout 3600

When I include a .deployment file in the Bots root directory zip file, I get this error message in Deployment Center (Preview) for the App Service. I also get a Zip Deployment Failed message in the Command Prompt window.

Using the following command to generate deployment script: 'azure site deploymentscript -y --no-dot-deployment -r "D:\local\Temp\zipdeploy\extracted" -o "D:\home\site\deployments\tools" --aspNetCore "C:\Users<username>\Source\Repos\MyBot\MyBot\MyBot.csproj"'. D:\Program Files (x86)\SiteExtensions\Kudu\91.21119.4922\bin\node_modules\kuduscript\lib\generator.js:90 throw new Error("The project file path should be a sub-directory of the repository root"); } ; ^

Error: The project file path should be a sub-directory of the repository root

Here is a sample of what my root directory for the BOT looks like.

enter image description here

BEG UPDATE 1

I removed the . in the Project name and folders, but it still didn't work.

Here is my .deployment file.

[config]
SCM_SCRIPT_GENERATOR_ARGS=--aspNetCore "C:\Users\<username>\Source\Repos\MyBot\MyBot\MyBot.csproj"

END UPDATE 1

Any idea what's happening and how to work around this?


Solution

  • I finally got it to work. The .deployment file should look like this. I used Notepad++ to edit it.

    [config]
    SCM_SCRIPT_GENERATOR_ARGS=--aspNetCore "MyBot.csproj"
    

    When you run the following command, it adds unnecessary information to the file.

    az bot prepare-deploy --lang Csharp --code-dir "./Source/Repos/MyBot/MyBot" --proj-file-path "C:\Users\<username>\Source\Repos\MyBot\MyBot\MyBot.csproj"