Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET core include files on publishing

Tags:

asp.net-core

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.

like image 471
Igor Avatar asked Dec 12 '25 07:12

Igor


1 Answers

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>
like image 131
Igor Avatar answered Dec 14 '25 22:12

Igor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!