2017-08-16 99 views
0

是否可以在發佈時包含某些文件並將它們放在特定文件夾中。 我想將所有報告文件(* .rdlc)放在發佈位置的文件夾中。Asp.net核心發佈包含文件

我試着用:

<ItemGroup> 
    <Content Include="..\Reports\**\*.rdlc" PackagePath="\Reports" CopyToPublishDirectory="Always"/> 
    </ItemGroup> 

但它總是把文件在公佈目標的根源。

+0

嘗試'<內容主要包括= 「../報告/ **/* RDLC」 packagepath的= 「報告/」 CopyToPublishDirectory = 「始終」/>' – user2771704

+0

可能的複製[ASP.NET Core:在發佈時排除或包含文件](https://stackoverflow.com/questions/42712055/asp-net-core-exclude-or-include-files-on-publish) – Set

+0

我看到該帖子,但它不適合我。看起來內容不識別PackagePath屬性。它把文件放入根目錄。 – Igor

回答

0

我找到解決辦法:

<ItemGroup> 
    <ReportFiles Include="..\Reports\**\*.rdlc"><Path>\Reports</Path></ReportFiles> 
</ItemGroup> 
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish"> 
    <Copy SourceFiles="@(ReportFiles)" DestinationFolder="$(PublishDir)\%(Path)" SkipUnchangedFiles="false" /> 
</Target> 
相關問題