Search code examples
azuredeploymentbotframework

Bot Framework publish and deploy to Azure from VS 2019 - missing files


I wrote a C# web bot using external resources (.lg and .dialog files), which - as I think - are not deployed along with the code. I deploy from VS2019, right click and "publish / azure / Azure App Service (windows 10)" into an already existing app service.

Which are the worst that asks almost nothing, I cant see how I can add files to the publishment package. The bot wont work on azure portal, after several hours I found where are the log files, and see that it says cant open the .lg file because it is missing.

In the adaptive dialog constructor:

this.Generator = new TemplateEngineLanguageGenerator(Templates.ParseFile(Configuration["Dialog.Templates.Root"]));

in my appsettings.json:

"Dialog.Templates.Root": "Templates/root-dialog-templates.lg",

How can I add files to copy along during the deployment?

Thanks for any suggestion and help!


Solution

  • You can include something like this sample in your .csproj file, assuming your .lg, .dialog files are under the Dialogs folder

      <ItemGroup>
        <None Remove="Dialogs\**\*.lg" />
        <None Remove="Dialogs\**\*.dialog" />
      </ItemGroup>
    
      <ItemGroup>
        <Content Include="Dialogs\**\*.lg">
          <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        </Content>
        <Content Include="Dialogs\**\*.dialog">
          <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        </Content>
      </ItemGroup>
    
    

    This way you'll find the deployed files in the same folder relative to the project's content root, which is usually current directory.