Bot Framework 从 VS 2019 发布并部署到 Azure - 缺少文件

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

我使用外部资源(.lg 和 .dialog 文件)编写了一个 C# 网络机器人,我认为这些资源没有随代码一起部署。我从 VS2019 部署,右键单击并“发布 / azure / Azure App Service (windows 10)”到一个已经存在的应用程序服务中。

最差的是几乎什么都不问,看不懂怎么把文件加到发布包里。机器人无法在 Azure 门户上运行,几个小时后我发现日志文件在哪里,看到它说无法打开 .lg 文件,因为它丢失了。

在自适应对话框构造函数中:

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

在我的 appsettings.json:

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

如何在部署过程中添加要复制的文件?

感谢您的建议和帮助!

假设您的 .lg.dialog 文件位于 Dialogs 文件夹

下,您可以在 .csproj 文件中包含类似此示例的内容
  <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>

这样您将在相对于项目内容根目录(通常是当前目录)的同一文件夹中找到已部署的文件。