.net core build produces localization folders
Asked Answered
O

5

61

I have a web asp.net solution that is using .net core 2.0. I am building it using the command:

dotnet publish MySolution.sln --configuration release --output d:\test_output

But when I check the output folder, I'm seeing a lot of localization folders, as you can see in the image bellow:

output content

Is there a way to publish the code without generating these folders?

Oppilate answered 24/1, 2018 at 14:25 Comment(1)
Your question predates it, but the same question, with an answer, is here: #48893950Stratocumulus
T
4

On the .csproj file, you look for "Microsoft.VisualStudio.Web.CodeGeneration.Design" Package reference and add the property ExcludeAssets="All"

<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.1" ExcludeAssets="All" />

Here is the reference: Disable Dll Culture Folders on Compile

Tollgate answered 31/1, 2020 at 18:7 Comment(0)
B
77

For the projects using ASP.NET Core 3.1, add this line to your *.csproj file:

<PropertyGroup>   
    <SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>

The source of the answer in this post: Disable Dll Culture Folders on Compile.

Best answered 4/6, 2020 at 17:10 Comment(1)
Remark: the property should be added inside the existing <PropertyGroup> node that contains <TargetFramework>, instead of adding a new <PropertyGroup>, which I tried first and noticed does not work.Teets
A
14

[in net 5.0] All above solutions didn't work for me. Out of despair I added:

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

and it worked, absolutely no idea why

Ait answered 28/4, 2022 at 15:8 Comment(0)
T
9

The solution provided by @Igor.K worked for my API project, but for the ASP.NET Core MVC website in my solution, I had to make a minor change.

Try adding the line below to your .csproj file.

<PropertyGroup>   
    <ResourceLanguages>en</ResourceLanguages>
</PropertyGroup>

You can edit this file by right-clicking your project and selecting "Unload Project". Then, when you right-click again you will be able to edit the .csproj file. Make sure you reload the project when you're finished though.

So, if SatelliteResourceLanguages doesn't solve your problem, ResourceLanguages might do the trick.

Thadeus answered 17/8, 2020 at 21:40 Comment(0)
T
4

On the .csproj file, you look for "Microsoft.VisualStudio.Web.CodeGeneration.Design" Package reference and add the property ExcludeAssets="All"

<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.1" ExcludeAssets="All" />

Here is the reference: Disable Dll Culture Folders on Compile

Tollgate answered 31/1, 2020 at 18:7 Comment(0)
C
2

Neither the SatelliteResourceLanguages nor the ResourceLanguages solutions worked for me. In my case the files were generated by the following reference:

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" ExcludeAssets="All" />

Affixing ExcludeAssets="All" to it as shown above resolved the issue.

Claudelle answered 2/4, 2022 at 19:27 Comment(1)
Your tests should be in a separate project.Mcnutt

© 2022 - 2024 — McMap. All rights reserved.