Question

Using NuGet to install the Microsoft.Bcl.Async package for a solution that has several dlls and just one exe, which uses all other dlls, NuGet automatically creates a .config file (or adds to an existing one) for every single project the Bcl package is added to.

In practice I end up with > 20 config files all containing the same redirects. I understand the redirect is needed, but is this actually required for all assemblies given they are all loaded by a single application (some of them by Prism if that matters)? I removed all .config files from the output directory, leaving just app.config and the application seems to work just fine. Is my assumption correct that once the bindingRedirect took effect upon starting the application, all other assemblies that are loaded into that domain also automatically use the redirect? Or are there any caveats? Main reason I'm asking is to know if all these config files should be included upon redistributing the application.

Was it helpful?

Solution

You can refer to this question:

Why NuGet adds app.config with assemblyBinding to LIBRARY projects during a NuGet package update?

I think the answer to the above question amply answers your query.

Still, if you want the summary, you are actually right. You just need one .config file in a single application. Per-assembly .config files are used in tests when you only are using/referencing the respective assembly. So, if you are deploying the application, you do not need the per-assembly .config files. The application wide .config file would suffice.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top