4

I'm starting to use Nuget in my solution to install Owin and some other dependencies in certain projects. I'm reading about Nuget and app.config files here

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

and here

https://msdn.microsoft.com/en-us/library/7wd6ex19.aspx

Now I know why are they used, binding specific versions and so on...

The problem that I'm having is that i.e I have a big solution with 32 projects.

If I install Owin in project C. An app.config file appears in projects A,B,D,F with the following information.

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
          <assemblyIdentity name="Microsoft.Owin" 
              publicKeyToken="31bf3856ad364e35" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
    </assemblyBinding>
</runtime>

Why I'm getting this? These projects are not using OWIN. Is there any way to avoid this? Or maybe installing it manually without using nuget?

Thank you.

P.S: I'm using VS2015 enterprise

EDIT:

The architecture that we have it's as follow. I Have project WebApi with Owin installed. That project is referenced with the project Connector. That project Connector and all that reference it have the previous app.config file. Is that correct? Why it's necessary if they are not using OWIN?

EDIT2:

I uninstalled all nuget packages from my solution using nuget package manager inside VS2015 and these files with that dependencies are still there.

Community
  • 1
  • 1
acostela
  • 2,597
  • 3
  • 33
  • 50
  • Are the projects A,B,D,F somehow dependent on C? I tried in my own solution and only the packages.config files was modified in the selected project. – RokX May 19 '16 at 09:38
  • @RokX not directly. All that projects reference to another project. But they are not direct referenced. – acostela May 19 '16 at 09:49
  • Look like VS2015 finds some dependencies and adds them to other projects. What if you manually delete in projects you don't need them - does it build? – RokX May 19 '16 at 11:54
  • 1
    Yes, it build my project. The problem is that after that when you install another package with Nuget, it regenerates all this useless files. As consquence the next developer that install something will face this problem again. It Is very annoying – acostela May 19 '16 at 12:22
  • Try adding the package to a new independent project and see if the problem repeats. I don't know a solution but is probably related to dependencies. – RokX May 19 '16 at 12:59
  • 1
    Possible duplicate of [Why NuGet adds app.config with assemblyBinding to LIBRARY projects during a NuGet package update?](https://stackoverflow.com/questions/22227675/why-nuget-adds-app-config-with-assemblybinding-to-library-projects-during-a-nuge) – Michael Freidgeim Jun 19 '17 at 05:32

1 Answers1

2

I suggest to trust NuGet and leave app.config changes that it does(khellang explained why), but if it is really annoys you, you can skip applying binding redirects

Michael Freidgeim
  • 26,542
  • 16
  • 152
  • 170
  • Thanks! I know that is an old question. But I will mark this as answer because we did what you post in your link about skipping binding redirects – acostela Jun 19 '17 at 07:39