如何访问部署在 Azure 上的 VS 代码

How to access VS code deployed on Azure

如何访问从 Visual Studio 部署到 Azure 中的所有文件?我正在使用我随后发布的机器人框架创建一个机器人。但是,当我去在线查看代码时,我无法通过应用服务看到所有文件 Editor/Kudu/etc。无法在站点目录中找到文件。

有人知道吗?

您可以进入网站的 "Kudu" 仪表板,使用 url 格式

http://<yoursitename>.scm.azurewebsites.net

这将为您提供一个基于 Web 的仪表板,包括一个调试控制台(基于 Web),您可以在其中浏览各种目录

在 Visual Studio 中,在 window "Server Explorer" 中单击并连接 "Azure"。

=> App Service=> Your site name => Files

在这里您可以看到所有文件,您可以直接在 Visual Studio 中编辑它们。

Web 应用程序在发布时通常不包含源代码。网站项目,另一方面做。可以在此处找到更多信息:https://msdn.microsoft.com/en-us/library/dd547590(v=vs.110).aspx#Anchor_1

如果您想在发布过程中包含源代码,可以使用 Post 部署脚本来完成:

在 .csproj 中:

  <Import Project="PostDeployScripts\IncludeSources.targets" Condition="Exists('PostDeployScripts\IncludeSources.targets')" />

IncludeSources.targets:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <CoreCompileDependsOn>$(CoreCompileDependsOn);IncludeSource</CoreCompileDependsOn>
  </PropertyGroup>  
  <Target Name="IncludeSource">
    <ItemGroup>
      <Content Include="**\*.cs" />
      <Content Include="**\*.csproj" />
      <Content Include="PostDeployScripts\*.*" />
    </ItemGroup>
  </Target>
</Project>