复制文件以使部署无效

时间:2016-09-19 21:15:33

标签: .net msbuild web-deployment

在我的csproj文件中,我有以下内容:

<CopyAllFilesToSingleFolderForPackageDependsOn>
      DeployTemplates;
      $(CopyAllFilesToSingleFolderForPackageDependsOn);
    </CopyAllFilesToSingleFolderForPackageDependsOn>

    <CopyAllFilesToSingleFolderForMsdeployDependsOn>
      DeployTemplates;
      $(CopyAllFilesToSingleFolderForMsdeployDependsOn);
    </CopyAllFilesToSingleFolderForMsdeployDependsOn>

我的DeployTemplate Target看起来像这样:

<Target Name="DeployTemplates">
    <ItemGroup>
      <_CustomFiles Include="Views\Shared\Templates\**\*" />
      <FilesForPackagingFromProject  Include="%(_CustomFiles.Identity)">
        <DestinationRelativePath>Views\Shared\Templates\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>
  </Target>

这可以正常工作,它会将这些附加文件按预期添加到Views下的PackageTmp文件夹中。

当实际部署发生时,这些文件没有部署,任何想法为什么会发生?

1 个答案:

答案 0 :(得分:1)

您可以尝试覆盖CollectFilesFromContent而不是CopyAllFiles ...

<PropertyGroup>
    <CollectFilesFromContentDependsOn>
       DeployTemplates;
       $(CollectFilesFromContentDependsOn);
    </CollectFilesFromContentDependsOn>
</PropertyGroup>