Search code examples
windowsvb.netdllservicecsvhelper

Windows service build includes DLL's not referenced


Using Visual Studio 2017 I have created a Windows service using VB.net. I have the root service class and a project installer class. The Service builds, installs, and runs as expected. With the following exception - the output to the BIN folder is enormous. The references listed are as follows:

    System
    System.Configuration
    System.Configuration.Install
    System.Deployment
    System.Net.Http
    System.Runtime.CompilerServices.Unsafe
    System.ServiceProcess
    System.Threading.Tasks.Extensions
    TSLogger (internall DLL that logs to Event log)

When I build the service the output to the bin folder includes over 100 .NET DLLs. At different points during development, using NuGet package manager, I have installed and uninstalled CsvHelper and Newtonsoft.Json.

Any idea what would set the compiler to include all these DLLs as part of the output? Or how I can control it?

I have attached a screenshot of the bin folder.

Bin folder screenshot: bin folder screenshot


Solution

  • So it turns out it was CsvHelper v15.0.0. I created a new solution, didn't add any code but just added references and as soon as I added CsvHelper with NuGet Package manager, the bin folder would fill up with all these framework DLLs.

    UPDATE

    I have confirmed I get the same result from CsvHelper version 14.0.0; versions 13.0.0 and 12.3.2 do not produce these results. I didn't test any other versions. The only difference I can see is that the latest 2 versions include a reference to System.Runtime.CompilerServices.Unsafe - could this be what brings in so much of the .NET Framework libraries??