84

I'm using 2 dlls (Microsoft.Expression.Interactions.dll and System.Windows.Interactivity.dll) that, when the parent application is compiled, create loads of culture folders:

And inside each are 2 dlls (Microsoft.Expression.Interactions.resources.dll and System.Windows.Interactivity.resources.dll). I've googled around and I just can't find anything related to how to stop this annoying auto-generated content.

Appulus
  • 18,630
  • 11
  • 38
  • 46
Alexander Forbes-Reed
  • 2,823
  • 4
  • 27
  • 44

12 Answers12

85

Faced the same problem. My project uses ASP.NET Core 3.1

Add this line to your *.csproj

<PropertyGroup>
   <SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>
al.koval
  • 2,087
  • 4
  • 28
  • 35
  • 7
    This worked for me. Please explain how you happened to find this information. Many thanks. – BoiseBaked Apr 17 '20 at 19:49
  • My project was a .NET Core 3.1 WPF desktop app that only Nuget referenced Microsoft.Expression.Interactions.dll and System.Windows.Interactivity.dll. – BoiseBaked Apr 17 '20 at 20:12
  • 1
    This worked for sdk csproj file format. Got rid of Microsoft.Win32.TaskScheduler.dll resourse files. Thanks – Boogier Jul 21 '20 at 14:43
  • 5
    +1 worked for me. The [docs](https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#satelliteresourcelanguages) explain how it works. – Eric Mutta Nov 20 '21 at 14:24
  • after adding that to csproj, do **Clean Project > rebuild Project** , to clear out the debug folder. – bh_earth0 Jan 05 '23 at 06:55
22

There are two workarounds for this issue:

  • copy System.Windows.Interactivity.dll and add a reference directly to this file
  • remove those folders from:
    \Program Files (x86)\Microsoft SDKs\Expression\Blend\.NETFramework\v4.5\Libraries

Related links:
Original solution
Generated files by caliburn.micro in Release directory

Community
  • 1
  • 1
Wojciech Kulik
  • 7,823
  • 6
  • 41
  • 67
  • If you have this problem when using ReportViewer you can remove the folders from `C:\Program Files (x86)\Microsoft SQL Server\140\SDK\Assemblies`. – AlexDev Oct 31 '17 at 12:01
  • Confirmed removing the folders from the SDK directory works. Note that you may need to also need to do the same in the `v4.0` folder or others depending on which SDKs you have installed and which FW your app is targeting. – Scott Solmer May 22 '18 at 21:20
22

I use other solution. You can configure Post-build event for your project in Visual Studio, wich will remove redundant folders:

rd /s /q "de", "en", "es", "fr", "it", "ja", "ko", "ru", "zh-Hans", "zh-Hant"

This solution is less invasive than removes folders from sdk folder.

Brien Foss
  • 3,336
  • 3
  • 21
  • 31
Digger
  • 294
  • 2
  • 10
  • 3
    post build events gives visual studio the tendency to rebuild projects even though they haven't changed. – Kai Oct 26 '16 at 11:26
10

I found a good answer for .NET Core 3

Just add ExcludeAssets="All" to the package reference.

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

This is the link for the original post on Microsoft Community: https://forums.asp.net/post/6281458.aspx

  • 2
    Doesn't work for me. I am using .NET Core 3.0 and .NET Core 3.1 – al.koval Dec 09 '19 at 13:03
  • 1
    For me it was a problem of the Microsoft.VisualStudio.Web.CodeGeneration.Design, and when I added the ExcludeAssets="All" the folders didn't appear anymore. You might need to clean the build folder first. – Jonatas W. Gonçalves Dec 10 '19 at 14:29
  • Please tell me which libraries you have installed from this list: https://www.nuget.org/packages?q=Microsoft.VisualStudio.Web.CodeGeneration? Maybe in my project, something is missing. – al.koval Dec 10 '19 at 14:47
  • @al.koval I have just this one in the example. – Jonatas W. Gonçalves Dec 11 '19 at 15:06
  • 3
    Solved the problem by adding the line " en " to the * .cproj file https://stackoverflow.com/a/60655083/2553037 – al.koval Mar 12 '20 at 13:27
7

I had the same issue in my project on .NET Core 3.1 using nuget package Microsoft.VisualStudio.Web.CodeGeneration.Design

First of all DELETE folder 'bin' from your project directory.

Then you need to set option 'ExcludeAssets' for the package.

In Visual Studio here:

enter image description here

Or another way is direct change in *.csproj file like this:

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

For me it solved the problem.

UPD: I found second solution - it's another way which lets you to chose which locale folders you need. But if you go this way - again delete 'bin' folder and set 'ExcludeAssets' option of chosen package to default value - empty.

In *.csproj file add tag 'SatelliteResourceLanguages' like this

...
<PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <SatelliteResourceLanguages>ru;en-US</SatelliteResourceLanguages>
</PropertyGroup>
...

For my project I now have default en-US locale and additional 'ru' locale. You can select another locales with devider ';' between them.

2nd solution found here https://github.com/dotnet/sdk/issues/774

  • Why the heck is this stuff being added to my deployment anyway? Looks like something that's needed for Visual Studio designers, and not for the users of my web application. Dumb! – Jonathan Wood Jun 16 '20 at 20:53
  • 1
    The only thing that worked for me in .netcore 3.1 is the second part of this answer. – Offir Aug 12 '20 at 18:29
  • @OffirPe'er it's kinda magic. I tested both solutions on my real .net core 3.1 project, both worked and I took second as more obvious. And there is one thing that I've discovered and still can't beat - both solutions work fine for Build/Rebuild of the project. But if I Publish my project using VS, I stil get all locale folders in publish directory and I still can't fix it. – Ivan Konstantinov Aug 14 '20 at 11:09
  • Same thing as Offir here. – Veverke Jun 14 '21 at 16:33
4

I had the same problem (similar answer here) but none of the other answers worked for me, so instead what I did was add the following lines to the end of my Main "csproj":

<ItemGroup>
    <FluentValidationExcludedCultures Include="be;cs;cs-CZ;da;de;es;fa;fi;fr;ja;it;ko;mk;nl;pl;pt;ru;sv;tr;uk;zh-CN;zh-CHS;zh-CHT">
        <InProject>false</InProject>
    </FluentValidationExcludedCultures> 
</ItemGroup>

<Target Name="RemoveTranslationsAfterBuild" AfterTargets="AfterBuild">
    <RemoveDir Directories="@(FluentValidationExcludedCultures->'$(OutputPath)%(Filename)')" />    
</Target> 

This will effectively remove the files after they are generated, not as good as not creating them in the first place, but it works for me.

David Rogers
  • 2,601
  • 4
  • 39
  • 84
3

Answer no longer relevant

Apply the System.Resources.NeutralResourcesLanguageAttribute attribute at the assembly scope, like so:

[assembly: System.Resources.NeutralResourcesLanguageAttribute("en")]

(A good place for this would be the AssemblyInfo.cs file in the properties section of the project)

Eyal Perry
  • 2,255
  • 18
  • 26
  • 1
    To all future readers, this answer did work at the time, but is indeed no longer relevant. – Eyal Perry Feb 20 '18 at 20:35
  • 1
    VS 2017 Unable to reproduce now, however adding both `[assembly: AssemblyCulture("en")] [assembly: System.Resources.NeutralResourcesLanguageAttribute("en")]` removed all my horrible folders. – codeMetis Jun 26 '18 at 05:25
  • please update the body of the answer with the remark that the answer is not relevant anymore these days. – Veverke Jun 14 '21 at 16:35
1

Fwiw, I was able to dump them from my build that used system.windows.interactivity.dll by modifying my csproj:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" 
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <Import Project="$(   **<CHOPPED**>... />
  <PropertyGroup>

 <!--added this line for system.windows.interactivity.dll to dump the localized dll's-->
    <SupportedCultures>en-US</SupportedCultures>
dethSwatch
  • 1,152
  • 1
  • 10
  • 18
  • 2
    Tried this, couldn't make it work. Maybe show more of your csproj? Like where exactly this node needs to be placed? – Scott Solmer May 22 '18 at 21:22
0

For .net 4.6.1 in VS 2019 ... Using NuGet manager for solution, I just clicked Remove Dependencies under Uninstall Options. That seemed to work for me.

Gapster
  • 41
  • 5
0

None of the given solutions worked for me. But the accepted answer - though poorly rated - did put me on the right track.

The content of each of my generated culture folders looked like this:

enter image description here

This lead me the the conclusion that the Nuget package that created these files was not the often mentioned Microsoft.VisualStudio.Web.CodeGeneration.Design package but one of the XUnit and Test packages that I had recently installed. By trial and error I finally found the culprit and the solution for me:

I added ExcludeAssets="All" to the Microsoft.NET.Test.Sdk package in .csproj like so...

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

...and the culture folders disappeared.

So my recommendation to solve the generic problem is:

  • Have a look into the generated culture folders.
  • From the names of the files in these folders try to determine, which Nuget package(s) might be responsible for the generation.
  • Add ExcludeAssets="All" to the corresponding <PackageReference> in your .csproj file.
  • Keep doing this with more PackageReferences until the culture folders disappear when building.

Disclaimer:
I am still on VS 2017 and Core 2.2, which might be the reason why the generic solution with SatelliteResourceLanguages did not work for me.

Jpsy
  • 20,077
  • 7
  • 118
  • 115
  • I had the exact problem. Microsoft.NET.Test.Sdk in my Unit test project probably imported along with NUnit. This fixed it. – Eternal21 Apr 02 '22 at 19:25
  • @Eternal21 then why didn't you vote for it? ;D – Jpsy Apr 25 '22 at 05:28
  • 1
    I did vote for it, it was sitting at -1. Here's proof: https://i.imgur.com/URVRkui.png Having said that I had to revert that workaround, because it was preventing the unit test project from building on our Build Server for some reason. – Eternal21 Apr 25 '22 at 11:16
0

Here is my horrid workaround in the csproj file. I wish the SatelliteResourceLanguages solution worked. My projects have many references, and I'm not sure which causes the problem now, nor do I know which new ones will cause the problem in the future. So this heavy-handed solution:

<PostBuildEvent>
        rd /s /q "$(TargetDir)de\" 2&gt;nul
        rd /s /q "$(TargetDir)cs\" 2&gt;nul
        rd /s /q "$(TargetDir)es\" 2&gt;nul
        rd /s /q "$(TargetDir)fr\" 2&gt;nul
        rd /s /q "$(TargetDir)it\" 2&gt;nul
        rd /s /q "$(TargetDir)ja\" 2&gt;nul
        rd /s /q "$(TargetDir)ko\" 2&gt;nul
        rd /s /q "$(TargetDir)pl\"&gt;2&gt;nul
        rd /s /q "$(TargetDir)pt-BR\" 2&gt;nul
        rd /s /q "$(TargetDir)ru\" 2&gt;nul
        rd /s /q "$(TargetDir)tr\" 2&gt;nul
        rd /s /q "$(TargetDir)zh-Hans\" 2&gt;nul
        rd /s /q "$(TargetDir)zh-Hant\" 2&gt;nul
    </PostBuildEvent>
Daniel Williams
  • 8,912
  • 15
  • 68
  • 107
-1

Just in Solution Explorer Click on Items That Changed Properties and in Properties Tab Change Copy Local to False.

ayub
  • 1
  • 1