How to move third party dlls from bin folder to another folder in ASP.NET Web Forms project?

1.8k views Asked by At

There are some third party dlls in Bin folder. I would like to move them to root/lib path. I think, it is not enough move the files to lib folder. How can i do this, safely? These are dlls;

  • Microsoft.Web.Infrastructure.dll
  • Newtonsoft.Json.dll
  • NReco.PdfGenerator
  • System.Web.Optimization.dll
  • WebGrease.dll

Update: I followed these instructions and i got an error like; The type or namespace name 'Optimization' does not exist in the namespace 'System.Web'

The error occurred on this line: using System.Web.Optimization;

I created a new lib folder on root directory, moved System.Web.Optimization.dll file to lib. Then, i edited my web.config as below;

    <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
  </dependentAssembly>
  <probing privatePath="bin;lib"/>
</assemblyBinding>

2

There are 2 answers

0
Ceylan B. On BEST ANSWER

I found the answer on this question. So, if you want to move third party dlls to new folder, you can follow these steps;

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="Bin;folder_path"/>
    </assemblyBinding>
</runtime>
  1. Create a new folder to move dlls
  2. Update web.config like above
  3. Add moved assemblies between system.web tags

    <add assembly="System.Web.Optimization" />
    <add assembly="Telerik.Web.UI" />
    
0
Anoop H.N On

You can check with the link below.

How to move all referenced DLLs into seperate folder in c#?

Hope this helps!