2

I'm using CSLA framework with dot net core 2.0.

When I do publish (dotnet publish -c Release -r ...) using Release configuration additional folders (tr, sv, sr) to name few of them, contains Csla.Resources.dll and they are copied in output publish folder ( ~/bin/Release/netcoreapp2.0/centos.7-x64/publish).

How to exclude these folders (with the file) or delete them from publish folder, once when dotnet publish finish executing?

Note File "Csla.resources.dll" doesn't exist before deploy process start. It will be generated when dotnet publish started.

ITGoran
  • 442
  • 1
  • 7
  • 18
  • Possible duplicate of [ASP.NET Core: Exclude or include files on publish](https://stackoverflow.com/questions/42712055/asp-net-core-exclude-or-include-files-on-publish) – Set Oct 01 '17 at 15:02
  • @ITGoran, How about this issue? Have you resolve this issue? If not, could you please let me know the latest status for this issue? – Leo Liu Oct 03 '17 at 07:05
  • @Leo-MSFT I've now tried answer provided by Martin Ullrich but it doesn't work because files "Csla.resources.dll" are generated during 'dotnet publish' process and doesn't exist before. – ITGoran Oct 03 '17 at 11:02
  • I don't think this is actually related to Csla; I'd guess this would happen with any assembly which provides localized resource assemblies. – Andy May 23 '18 at 23:30
  • @Andy I think you right, I use Cake script to remove not needed assets. – ITGoran May 25 '18 at 21:07

2 Answers2

1

How to exclude these folders (with the file) or delete them from publish folder, once when dotnet publish finish executing?

According to the below document:

https://learn.microsoft.com/en-us/aspnet/core/publishing/web-publishing-vs?tabs=aspnetcore2x

You can use CopyToPublishDirectory="Never" to excluding files and folders:

<ItemGroup>
  <Content Update="wwwroot/content/**/*.*" CopyToPublishDirectory="Never" />
</ItemGroup>
Leo Liu
  • 71,098
  • 10
  • 114
  • 135
0

If you don't know where exactly those files are, you can use msbuild to exclude all folders where one is found by adding this to the csproj file:

<ItemGroup>
  <_CslaResourcesAssemblies Include="**/Csla.Resources.dll" />
  <Content Update="@(_CslaResourcesAssemblies->'%(RecursiveDir)**')" CopyToPublishDirectory="Never" />
</ItemGroup>
Martin Ullrich
  • 94,744
  • 25
  • 252
  • 217