sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Publish output is different when specifying custom --output location

Open jasonkarns opened this issue 6 years ago • 3 comments

We're using .net core 3.1 and efcore 3.1, including the efcore .Design package. During publish our output directory included lots of localization files that are unnecessary for us.

After some googling we came across these relevant threads:

https://stackoverflow.com/questions/48424796/net-core-build-produces-localization-folders https://stackoverflow.com/questions/48893450/visual-studio-2017-localization-publish-settings https://stackoverflow.com/questions/20342061/disable-dll-culture-folders-on-compile/60655083#60655083 https://github.com/dotnet/sdk/issues/774

The approach that worked for us was adding <SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>.

And for a time all was well, until we changed our publish command to emit to a custom --output location. That change (and only that change) caused the publish output to suddenly contain all those unnecessary localization directories again.

After a clean build:

dotnet publish --configuration Release -p:EnvironmentName=Staging --runtime win-x64 --no-self-contained
$ ls UpgApi/bin/Release/netcoreapp3.1/win-x64/publish | wc -l
      98
$ dust UpgApi/bin/Release/netcoreapp3.1/win-x64/publish
# total size 40M

Changing nothing but adding an explicit --output:

dotnet publish --configuration Release -p:EnvironmentName=Staging --runtime win-x64 --no-self-contained --output webapp
$ ls -l webapp | wc -l
     150
$ dust webapp
# total size 57M

I don't understand why changing the output location would cause the output to differ, but it makes me very nervous. I'd expect identical commands but with a custom output location to produce identical outputs.

jasonkarns avatar Oct 21 '20 20:10 jasonkarns

Also having this issue. We're seeing localization data from Microsoft.VisualStudio.TraceDataCollector.resources.dll in localization folders. We're using a custom output directory on solution level and have set the SatelliteResourceLanguages to de, even within the command (within a powershell script):

dotnet msbuild /t:Publish /p:Configuration=Release /p:PublishDir=../$outDir/$apiDir /p:SatelliteResourceLanguages=de

loudar avatar Jun 07 '24 07:06 loudar

Hello, I see the same issue with "dotnet publish" for Test Projects. Some online posts suggest adding ExcludeAssets="All" to the "Microsoft.NET.Test.Sdk" ProjectReference. However, doing so also removes files such as "testhost.exe" which prevents me from running Automated Tests.

Any thoughts?

deepakjgupta avatar Jul 23 '24 11:07 deepakjgupta

using a custom output folder and SatelliteResourceLanguages seems to work fine for me under dotnet9

kevin-osborne avatar May 14 '25 05:05 kevin-osborne