-1

I have a .NET windows service made in VB.NET in Visual Studio 2013. In this project I have some DLLs referenced and also in app.config I have others defined as dependentAssembly (I didn't make this project).

When I compile this project, dependent assemblies specified in app.config are not being copied to output directory (debug or release depending on the case).

My questions are:

  1. What is the difference between specifying dependent assemblies in app.config and reference a DLL?
  2. Why dependent assemblies specified in app.config are not being copied to the output directory (debug or release) when compiling?
  3. Can I force visual studio to copy dependent assemblies specified in app.config to outut directory (debug/release) when compiling?
Willy
  • 9,848
  • 22
  • 141
  • 284
  • This question seems to be based on a very mistaken idea of what app.config is all about. It plays no role at build-time whatsoever, only runtime. The real problem you have is impossible to guess at. – Hans Passant Mar 05 '20 at 10:56
  • @HansPassant ok,but why dependentAssemblies are there? I wonder If they were added manually in app.config or nuget added them?as far as i know nuget does not add anything in app.config, right? Also, If depdent assemblies are added to app.config, Do I have the responsability to copy manually those assemblies to the appropiate folder when deploying my app (because those assemblies are not automatically copied)? – Willy Mar 05 '20 at 17:12
  • Why the downvote? – Willy Mar 12 '20 at 22:16

1 Answers1

-1

Here is the relevant information I found about dependentAssembly. App.config should not be used on dlls, but only with executables.

If a dll is loaded in an executable, the dll will use the configuration file of the running executable and will ignore the configuration defined for him.

If you like, you can read the configured keys using some ugly code that takes them from the configuration file for the current assembly.

What you should do is put the relevant configuration into the exe configuration file. You can checked in this link for more details.

Julie Xu-MSFT
  • 334
  • 1
  • 5