3

I have a asp.net website poject. I need to use several custom dll's which I can't copy into the bin directory.

I tried to create a custom bin folder and set on Application_Start PrivateBinPath in Global.asax to that directory



    void Application_Start(object sender, EventArgs e) 
        {
            AppDomain.CurrentDomain.SetupInformation.PrivateBinPath = Server.MapPath("~/my_DLLS");
        }

then in my .cs file use a using statement to include that dll but I'm getting Compiler Error Message: CS0246: The type or namespace name 'DLLNAME' could not be found (are you missing a using directive or an assembly reference?)

I also trying to add assemblyBinding in web.config



    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <probing privatePath="my_DLLS" />
        </assemblyBinding>
      </runtime>

i feel like i'm missing something.

VGV
  • 41
  • 5
  • Try moving the entire project to an easy-to-access path, like C:\Test, no spaces or anything and try again. – Hanlet Escaño Jul 02 '13 at 16:00
  • the project is on the server. the path contains no spaces. I'm able to reference all the dll from the bin directory but not from my custom directory – VGV Jul 02 '13 at 16:04

1 Answers1

0

Some thoughts

  1. Make sure that your private bin path is under the application root (your code indicates that it is - but just confirm)

  2. Do the private bin dlls have any dependencies that are not present in the private bin

  3. You can use fusion log viewer to check the bindings of the dlls in your app. That should indicate if there are bound or not

  4. Check permissions on the private bin folder. Hit it with a hammer and give everyone full permissions on that folder. See if that brings it up

  5. As a temporary measure - put the private bin folder as a sub directory under your bin folder. Does that work now? Could that be a permanent solution if it does work. Might not be a goer for you

This is a good answer about a similar problem - with a nice diagram that you might find helpful

How do I reference assemblies outside the bin folder in an ASP.net application?

And of course good luck

Community
  • 1
  • 1
Crab Bucket
  • 6,219
  • 8
  • 38
  • 73
  • my custom bin directory is on the same level as bin same exact same permissions as bin. one of the dll's is PdfSharp.dll in I'm getting the error in this line PdfSharp.PdfDocument document = new PdfSharp.PdfDocument(); – VGV Jul 02 '13 at 16:27
  • erm - if you are getting an error in that line then it is loading the PdfSharp.dll for sure. So it is finding your private bin. A dependency maybe. Have you tried the fusion log viewer. – Crab Bucket Jul 02 '13 at 17:36
  • just did. it looks good. if I move the dll from my custom folder back to the bin everything works. I move it back and it doesn't. I truing with other dll and same error. Compiler Error Message: CS0246: The type or namespace name 'FreeTextBoxControls' could not be found (are you missing a using directive or an assembly reference?) FreeTextBoxControls.FreeTextBox topicEditor = new FreeTextBoxControls.FreeTextBox(); – VGV Jul 02 '13 at 19:22
  • I was able to loop thru each Assembly and I do see the one I loaded when I loop try the types I see all of the methods of the dll but Assembly FreeTextBox, Version=3.3.1.12354, Culture=neutral, PublicKeyToken=5962a4e684a48b87 Namespace = Name GetTypes FreeTextBoxControls=ToolbarListItem GetTypes FreeTextBoxControls=AssemblyResourceHandler GetTypes FreeTextBoxControls=ImageGallery but Namespace FreeTextBoxControls don't give me any of the methods – VGV Jul 02 '13 at 21:02