.Net Core Console Apps Dependency DLLs

I understand that .Net Core is designed for performance, with minimum overhead. As such, we only include the NuGet Packages that we need to build a particular app with specific requirements.

Now let’s suppose that we are required to build 20 console applications. As we publish each console app, each executable would require and include the referenced DLLs in its published folder. Some may have similar sets of DLLs, other would have other sets of DLLs. When we deploy these console apps to a server to run on schedule, we would have to copy those published folders, each with DLLs that may be the same with DLLs in some of the other published folders.

For example, we could have a.dll, b.dll, c.dll in 8 folders, c.dll, d.dll, e.dll in 7 folders and so on so forth.

Now the question is: Is there a way to consolidate these dlls in a particular folder in the deployed server, so that when we release an updated app, all we need to copy is just the executable.

One way to house the DLLs in a separate common folder is by editing appName.runtimeconfig.json in the publish folder, by adding something like this
“additionalProbingPaths”: [
“c:\CoreDLL\”
]

And, by editing appName.deps.json and changed those DLL runtime filenames to C:/CoreDLL/Dllfilename.DLL in this case. But this is pretty hooky because everytime we publish, these two files get wiped out. We need to save these files somewhere and recopy back. That’s so much work …

.NET Foundation Website | Blog | Projects | Code of Conduct