包括项目未引用的文件夹?

时间:2016-07-12 15:50:02

标签: asp.net visual-studio-2015 msbuild webdeploy

我试图找出如何上传我不想在项目文件中引用的文件夹。文件夹" build"是从webpack生成的输出步骤。我发现其他线程有同样的问题,这就是我尝试过的(添加到我的pubxml文件的末尾:

  <PropertyGroup>
    <CopyAllFilesToSingleFolderForPackageDependsOn>
      CustomCollectFiles;
      $(CopyAllFilesToSingleFolderForPackageDependsOn);
    </CopyAllFilesToSingleFolderForPackageDependsOn>
  </PropertyGroup>
  <Target Name="CustomCollectFiles">
    <ItemGroup>
      <_CustomFiles Include="..\build\**\*" />

      <FilesForPackagingFromProject  Include="%(_CustomFiles.Identity)">
        <DestinationRelativePath>build\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>
  </Target>

哪个不起作用

1 个答案:

答案 0 :(得分:1)

尝试“CopyAllFilesToSingleFolderFor MSDeploy DependsOn”而不是“CopyAllFilesToSingleFolderFor Package DependsOn”。

  <PropertyGroup>
    <CopyAllFilesToSingleFolderForMSDeployDependsOn>
      CustomCollectFiles;
      $(CopyAllFilesToSingleFolderForMSDeployDependsOn);
    </CopyAllFilesToSingleFolderForMSDeployDependsOn>
  </PropertyGroup>

根据我对最新MSDeployAddFilesOutsideOfProject.wpp.targets文件(随VS2015一起发布)的评论,可能不推荐使用“ForPackage”。目标仍在那里,但我找不到它的引用位置。

更新 - 撰写了一篇包含更多详细信息的快速博文:

http://www.dotnetcatch.com/2016/07/20/include-extra-files-in-webdeploy-package/