Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent satellite assemblies from being published

Tags:

c#

.net-core

When publishing with "dotnet publish" via command line, localization and code coverage satellite assemblies always appear (as shown in the image).

I have found a partial solution, that is, to add

<SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>

in the .csproj files to remove those language specific assemblies. The reason why it doesn't solve the problems completely is that while it removed all localization satellite assemblies from the regular projects, some still remained in the xUnit projects. Each of the language folders in the image contains only a single dll, "Microsoft.VisualStudio.TraceDataCollector.resources.dll", while the code coverage folder contained some codecoverage specific dlls and an exe.

I have tried various solutions that I have found around, such as adding the following in the .csproj:

<ItemGroup>
   <Content Include="wwwroot\LicenceFiles" CopyToPublishDirectory="Never" />
</ItemGroup>

but none helped. It worked for removing the wwwroot folder, but for any of the language folders it didn't do anything when those were specified instead. The partial solution I mentioned above is the only thing that ended up removing something. I'm looking for a way to delete those folders without the usage of a batch files or similar, purely through project settings, publishing options or anything like that.

I'm using dotnet core version 2.2.203.

Extra folders

like image 321
Memfisto Avatar asked Jun 12 '19 14:06

Memfisto


1 Answers

I also added the SatelliteResourceLanguages tag in my start up .NET Core Web Project, but found the same issue when deploying the solution. I added the IsPublishable tag into my Tests Project and those files no longer deploy with my solution.

WebApp.Tests.csproj

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <IsPackable>false</IsPackable>
    <IsPublishable>false</IsPublishable>
  </PropertyGroup>

WebApp.UI

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <SatelliteResourceLanguages>en</SatelliteResourceLanguages>
  </PropertyGroup>
like image 189
hayoeu Avatar answered Nov 08 '22 07:11

hayoeu