-1

我一直在使用 Gulp 来缩小和连接我的脚本文件并将我的 SASS 文件编译为 css。我们在 Visual Studio Team Services 上托管我们的文件,我正在尝试使用新的 Visual Studio 2015 构建系统。一切正常,我可以调用我的 gulp 任务并且它的运行没有问题。问题是因为创建的文件不是项目的一部分,它们不包含在我的部署包中。
我想知道是否有其他人有同样的问题并找到了包含这些文件的方法。谢谢。

4

1 回答 1

2

您可以将以下部分添加到项目文件中以包含额外文件:

  <Target Name="CustomCollectFiles">
    <ItemGroup>
      <_CustomFiles Include="<<<ExtraFilesToInclude>>>" />
      <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
        <DestinationRelativePath>%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>
  </Target>
  <PropertyGroup>
    <CopyAllFilesToSingleFolderForPackageDependsOn>
      CustomCollectFiles;
      $(CopyAllFilesToSingleFolderForPackageDependsOn);
    </CopyAllFilesToSingleFolderForPackageDependsOn>
    <CopyAllFilesToSingleFolderForMsdeployDependsOn>
      CustomCollectFiles;
      $(CopyAllFilesToSingleFolderForPackageDependsOn);
    </CopyAllFilesToSingleFolderForMsdeployDependsOn>
  </PropertyGroup>

详细参考这篇文章:http ://www.asp.net/mvc/overview/deployment/visual-studio-web-deployment/deploying-extra-files

于 2016-01-08T03:46:23.370 回答