如何使用.PublishSettings文件

时间:2017-05-31 09:49:43

标签: visual-studio angular azure asp.net-core

尝试this但失败了,之前使用Git存储库在Azure上部署Web应用程序但现在想要使用Visual Studio 2015使用.publishSettings文件仅发布dist文件夹以克服gitbash上的git命令执行。项目在.Net Core,Angular 2与webpack。尝试编辑像这样的.publishSettings

<publishData>
<publishProfile profileName="***** - Web Deploy" publishMethod="MSDeploy" publishUrl="****.scm.azurewebsites.net:443" msdeploySite="****" userName="$***" userPWD="****" destinationAppUrl="http://****.azurewebsites.net" SQLServerDBConnectionString="" mySQLDBConnectionString="" hostingProviderForumLink="" controlPanelLink="http://windows.azure.com" webSystem="WebSites">
  <databases />
</publishProfile>
<publishProfile profileName="***** - FTP" publishMethod="FTP" publishUrl="ftp://***-***-***.azurewebsites.windows.net/site/wwwroot" ftpPassiveMode="True" userName="****\$****" userPWD="*******" destinationAppUrl="http://****.azurewebsites.net" SQLServerDBConnectionString="" mySQLDBConnectionString="" hostingProviderForumLink="" controlPanelLink="http://windows.azure.com" webSystem="WebSites">
  <databases />
</publishProfile>
<Target Name="MoveDistToRoot" AfterTargets="CopyAllFilesToSingleFolderForMsdeploy">
<!--1.Deleting Folders except dist-->
<ItemGroup>
  <_FolderToDelete Include="$(_PackageTempDir)\src" />
  <!--you could add more folder paths as follows:-->
  <!--<_FolderToDelete Include="$(_PackageTempDir)\folderName" />-->
  <_FolderToDelete Include="$(_PackageTempDir)\refs" />
  <_FileToDelete Include="$(_PackageTempDir)\*.dll" />
  <_FileToDelete Include="$(_PackageTempDir)\web.config" />
</ItemGroup>
<RemoveDir Directories="@(_FolderToDelete)" />

<!--2.Copying files,folders from dist to root directory-->
<ItemGroup>
  <_FileToMove Include="$(_PackageTempDir)\dist\**" />
</ItemGroup>
<Move SourceFiles="%(_FileToMove.Identity)" DestinationFolder="$(_PackageTempDir)\%(RecursiveDir)" />

<!--3.Deleting the empty folder dist-->
<RemoveDir Directories="$(_PackageTempDir)\dist" />
</Target>
</publishData>

使用文件系统文件夹结构发布时,如下所示 folder structure

和dist文件夹

dist folder structure

1 个答案:

答案 0 :(得分:1)

  

如何使用.PublishSettings文件将dist文件夹部署到azure网站

如果您只想部署dist文件夹,可以右键单击此文件夹并选择Publish dist菜单。它只会将dist文件夹部署到您在发布设置文件中定义的Web服务器或文件夹。

enter image description here