Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the SatelliteResourceLanguages MSBuild property #18995

Closed
DamianEdwards opened this issue Jun 17, 2020 · 4 comments · Fixed by #26171
Closed

Document the SatelliteResourceLanguages MSBuild property #18995

DamianEdwards opened this issue Jun 17, 2020 · 4 comments · Fixed by #26171
Assignees
Labels
doc-enhancement Improve the current content [org][type][category] Pri2

Comments

@DamianEdwards
Copy link
Member

In .NET Core 2.1 (SDK 2.1.300) we added support for specifying languages to preserve satellite resource assemblies for during publish. See dotnet/sdk#774 for details.

<PropertyGroup>
  <SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>
</PropertyGroup>

In a new .NET Core WinForms app, setting this property to "en-US" (the runtime's default language) will result in a saving of 15 MB on the size of the app when published self-contained. When combined with the PublishTrimmed flag, this is an ~18% size saving.

Other packages commonly used in .NET Core apps (including ASP.NET Core, WinForms, and WPF apps) include embedded satellite resource assemblies that don't provide any benefit in cases where the app is only ever run in a single language context anyway.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@stevenvolckaert
Copy link

What's the status on documenting the SatteliteResourceLanguages property; is it suppported or not?

I have many ASP.NET Core projects targeting netcoreapp3.1, they all have a reference to

<PackageReference Include="Humanizer" Version="1.33.7" />

Adding the SatteliteResourceLanguages property, e.g. setting its value to en;fr;nl doesn't make a difference. The build output and publish output still have a large number of localized Humanizer DLLs in languages I don't need.

@DamianEdwards
Copy link
Member Author

@stevenvolckaert note your spelling of the property, you have a typo there. It should be SatelliteResourceLanguages with only one t and two ls. When I replicate the correct setup locally it works for me.

Also the version of Humanizer you're using is 6 years old. Any reason you haven't updated to a 2.x version that properly supports .NET Core and .NET Standard?

@gewarren gewarren self-assigned this Sep 14, 2021
@stevenvolckaert
Copy link

stevenvolckaert commented Sep 15, 2021

Thanks for pointing this out @DamianEdwards!

I tried again with correct spelling, and it works, both with Humanizer v1.33.7 and v2.11.10. (We've currently remained with v1.33.7 because there hasn't been an opportunity yet to upgrade.)

However, this only works if SatelliteResourceLanguages is added to the project that contains the Humanizer package reference: In our case, it is an utility library that directly references Humanizer, and a number of ASP.NET, ASP.NET Core, .NET Framework and .NET Core projects reference the utility library via a ProjectReference.

Yesterday I added SatelliteResourceLanguages property (which I, like in my previous comment, might have spelled incorrectly) to one of the ASP.NET Core projects, and noticed it didn't work.

The SatelliteResourceLanguages needs to be added to the utility project, then it works.

@gewarren Because I see you've assigned this issue to yourself: Perhaps you'll find it useful to add this finding to the docs. It wasn't immediately obvious to me.

Thanks a lot for your help @DamianEdwards! Much appreciated! 👌😎

@DamianEdwards
Copy link
Member Author

Logged an issue to get this added to the MSBuild schema so it shows up in IntelliSense too: dotnet/msbuild#6854

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-enhancement Improve the current content [org][type][category] Pri2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants