Fsharp: Using msbuild copies many `FSharp.Core.resources.dll` and xml files into output directory

Created on 17 May 2019  路  2Comments  路  Source: dotnet/fsharp

I still have the same issue that I reported at https://github.com/fsharp/fsharp/issues/868.

Related issue might be https://github.com/dotnet/fsharp/issues/6007

Previously when I used Mono's xbuild I got only FSharp.Core.dll and some other needed dll files into the output directory, i.e only the things needed to run the program. After seeing the _deprecation_ warnings during builds I switched to msbuild, but problem is that now these extra directories started to appear in the output directory:

drwxrwxr-x. 2 mclang   38 2019-05-17 06:55 cs/
drwxrwxr-x. 2 mclang   38 2019-05-17 06:55 de/
drwxrwxr-x. 2 mclang   38 2019-05-17 06:55 en/
drwxrwxr-x. 2 mclang   38 2019-05-17 06:55 es/
drwxrwxr-x. 2 mclang   38 2019-05-17 06:55 fr/
drwxrwxr-x. 2 mclang   38 2019-05-17 06:55 it/
drwxrwxr-x. 2 mclang   38 2019-05-17 06:55 ja/
drwxrwxr-x. 2 mclang   38 2019-05-17 06:55 ko/
drwxrwxr-x. 2 mclang   38 2019-05-17 06:55 pl/
drwxrwxr-x. 2 mclang   38 2019-05-17 06:55 pt-BR/
drwxrwxr-x. 2 mclang   38 2019-05-17 06:55 ru/
drwxrwxr-x. 2 mclang   38 2019-05-17 06:55 tr/
drwxrwxr-x. 2 mclang   38 2019-05-17 06:55 zh-Hans/
drwxrwxr-x. 2 mclang   38 2019-05-17 06:55 zh-Hant/

Each of these directories contain only singe file, FSharp.Core.resources.dll library, that seems not to be needed because the program works also without them.

In addition some extra XML files started also to be copied into the output directory, like these:

-rw-rw-r--. 1 mclang 760K 2019-02-13 23:34 FSharp.Core.xml
-rw-rw-r--. 1 mclang 444K 2019-03-01 00:03 Google.Protobuf.xml
-rw-rw-r--. 1 mclang 802K 2019-01-28 07:41 MySql.Data.xml
-rw-rw-r--. 1 mclang 1.5M 2018-11-06 17:07 NLog.xml

This happens whether I build directly using msbuild or with FAKE. The program in question use only plain English localisation, so no extra language resources should be needed.

Is there something I can do in the code to make msbuild to skip these files?

Workarounds

I got rid of the XML files by adding this into the debug and release sections of the fsproj file:

<AllowedReferenceRelatedFileExtensions>
    .mdb
    .pdb
</AllowedReferenceRelatedFileExtensions>

For removing the unnecessary directories I added this section in to he fsproj file:

<Target Name="AfterBuild">
  <ItemGroup>
    <FSharpCoreResourcesFiles Include="$(OutputPath)**\FSharp.Core.resources.dll" />
    <FSharpCoreResourcesDirs Include="@(FSharpCoreResourcesFiles-&gt;'\%(Directory)') " />
  </ItemGroup>
  <RemoveDir Directories="@(FSharpCoreResourcesDirs)" />
</Target>

System Information

  • CentOS Linux release 7.6.1810 (Core)
  • Mono JIT compiler version 5.16.0.220
  • FShap 4.1.33-0.xamarin.8.epel7
  • FSharp.Core (4.6.2)

Most helpful comment

@mclang

if you are using the new sdk-style project format you can add this property to your project

<SatelliteResourceLanguages>en</SatelliteResourceLanguages>

this should ensure that these resource dlls are not deployed

All 2 comments

@mclang

if you are using the new sdk-style project format you can add this property to your project

<SatelliteResourceLanguages>en</SatelliteResourceLanguages>

this should ensure that these resource dlls are not deployed

Was this page helpful?
0 / 5 - 0 ratings