Igor
Igor

Reputation: 381

ASP.NET core include files on publishing

Is it possible to include some files on publishing and put them in specific folder.

I would like to put all report files (*.rdlc) in folder Reports in the publish location.

I tried with:

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

But it always puts files in to the root of the published destination.

Upvotes: 3

Views: 2362

Answers (1)

Igor
Igor

Reputation: 381

I find solution:

<ItemGroup>
    <ReportFiles Include="..\Reports\**\*.rdlc">
        <Path>\Reports</Path>
    </ReportFiles>
</ItemGroup>

<Target Name="PrepublishScript"
        BeforeTargets="PrepareForPublish">
    <Copy SourceFiles="@(ReportFiles)"
          DestinationFolder="$(PublishDir)\%(Path)"
          SkipUnchangedFiles="false" />
</Target>

Upvotes: 8

Related Questions