[Deployment] DLL not found in some cases

Discussions about PDF management.
Post Reply
j2df
Posts: 11
Joined: Fri Nov 01, 2013 5:19 pm

[Deployment] DLL not found in some cases

Post by j2df » Thu May 12, 2016 10:02 am

Hello,

Two years ago I opened a topic in this forum about trying to add the required DLL for my application to a bin folder in my application. Here it is.

Since then we deployed our software along with the following DLLs :

- GdPicture.NET.10.filters.dll and GdPicture.NET.10.filters.64.dll
- GdPicture.NET.10.image.gdimgplug.dll and GdPicture.NET.10.image.gdimgplug.64.dll
- GdPicture.NET.10.ocr.tesseract.3.dll and GdPicture.NET.10.ocr.tesseract.3.64.dll

On around 400 different computers. And on deployment, I added my Program files/application/bin folder the the path (as mentionned in the previous topic) so that the required DLL can be found and loaded by my application. This solution worked.... most of the time. In about 20% percent of the cases, we had an unexpected error, crashing the app on startup (before we could debug any of it) and returning this error in Windows event log :

Code: Select all

Application: [name of my application].exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Exception
Stack:
   at gdpicture_?.gdpicture_?(Boolean)
   at gdpicture_?.gdpicture_?(Boolean)
   at gdpicture_?.gdpicture_?(Int32)
   at gdpicture_?.?(System.String, System.String ByRef)
   at GdPicture10.LicenseManager.RegisterKEY(System.String)
   at [name of my application].Application..ctor()
   at [name of my application].Application.Main()
Which is the same error I had when trying to test early versions of my application on another PC without copying these DLL along (as you can see in this post). So I figured that was the problem and what I simply did was copy all these DLL in the C:\Windows\Microsoft.NET\assembly\GAC_MSIL\GDPicture.Net.10 folder (since this folder is picked up allright by the app). So when the app crashes on startup, we know we need to copy those 6 DLL's in this folder and then everything works magically again.

But with Windows 10 we're getting more and more of these problems, around 90% of the time we deploy in W10 we have to copy those DLLs. We even had a PC, upgraded from 8 to 10, on which we we're unabled to get the application to work, even when copying those DLLs.

I read all the stuff about redistributing those DLLs, I tried regsvr32 on them but it looks like they cannot be registered, I tried registering them with my Wix deployment system but they're not .net dlls either.

I'm running out of ideas and I'm afraid we'll get more of these problems since more and more PC are updated to W10 every day. Do you have any idea? Any suggestions or advice on how to use / register those DLLs or how to change my code to load them manually (in VB.Net or C#) or any other possibility? It's hard to believe I'm the only one struggling with those DLLs...

Thanks

Cedric
Posts: 269
Joined: Sun Sep 02, 2012 7:30 pm

Re: [Deployment] DLL not found in some cases

Post by Cedric » Fri May 20, 2016 3:47 pm

Hello,

This is very strange, we never had this kind of issue and because of the way you fixed it, it tends to make me think that your deployment process must be wrong at some point.
You are definitely not supposed to copy anything to the GAC in order to deploy an application that is using GdPicture.NET, you simply need to copy specific files in the same directory as the main .exe

GdPicture.NET.10.filters.dll, GdPicture.NET.10.filters.64.dll, GdPicture.NET.10.image.gdimgplug.dll, GdPicture.NET.10.image.gdimgplug.64.dll, GdPicture.NET.10.ocr.tesseract.3.dll and GdPicture.NET.10.ocr.tesseract.3.64.dll are all C++ libraries that are actually dependencies of the main SDK library that GdPicture.NET.10.dll is. That's why you can't "register" them, you're not supposed to do it anyway.

I also don't see any mention to GdPicture.NET.10.dll in your file list, can you please list EXACTLY what is your file listing is with this deployment?
The unhandled exception error message you are showing indicates that the main DLL is missing as it cannot even perform the key registration.

j2df
Posts: 11
Joined: Fri Nov 01, 2013 5:19 pm

Re: [Deployment] DLL not found in some cases

Post by j2df » Fri May 27, 2016 2:57 pm

Thanks for your answer!
Cedric wrote: This is very strange, we never had this kind of issue and because of the way you fixed it, it tends to make me think that your deployment process must be wrong at some point.
You are definitely not supposed to copy anything to the GAC in order to deploy an application that is using GdPicture.NET, you simply need to copy specific files in the same directory as the main .exe
As I said in the topic I mentioned in my first post, I wanted to put all the GDPicture dlls inside a bin folder in my application's folder. Hence the dlls are note in the same directory as the .exe. What I did to make this work was adding this bin folder to the windows PATH variable, when installing my application. This way the dlls get picked up. Even on the computers that don't work with GDPicture at first, I can see that the bin folder is in the path (and is accessible in command line for example).
I also don't see any mention to GdPicture.NET.10.dll in your file list, can you please list EXACTLY what is your file listing is with this deployment?
My deployment is as follow :

- GDPicture.Net.10.dll and GDPicture.Net.10.PDF.dll being .NET assemblies they're registered as .NET assemblies on deployment. I don't need to copy them to my bin folder since they're registered in the GAC.
- All the other dlls I mentionned are in the bin folder of my app.

I don't see what more I can do. Copying the dlls inside the bin folder and giving Windows access to it through the path variable should be enough, since it's working on 80% on the computers. Having to copy those dlls inside the GAC is really odd...

When you say :
The unhandled exception error message you are showing indicates that the main DLL is missing as it cannot even perform the key registration.
It means to you that the missing DLL that cannot be found by my application on startup is in fact the GdPicture.Net.10.dll and not one of the C++ libraries?

Cedric
Posts: 269
Joined: Sun Sep 02, 2012 7:30 pm

Re: [Deployment] DLL not found in some cases

Post by Cedric » Fri May 27, 2016 3:04 pm

I don't need to copy them to my bin folder since they're registered in the GAC.
Yes you do, that's why this is what is advised in the documentation.
It means to you that the missing DLL that cannot be found by my application on startup is in fact the GdPicture.Net.10.dll and not one of the C++ libraries?
Exactly. If you simply copy GDPicture.Net.10.dll and GDPicture.Net.10.PDF.dll in the same folder alongside the C++ dependencies as per the documentation, there is no reason it will fail.
We have thousands of customers following this deployment scheme for years and we also do it ourselves for internal projects and even commercial software.

j2df
Posts: 11
Joined: Fri Nov 01, 2013 5:19 pm

Re: [Deployment] DLL not found in some cases

Post by j2df » Mon May 30, 2016 8:41 am

Well I'm really sorry I didn't see that in the doc, my mother language is not english so maybe I missed it. In any case I tried adding those DLL to my bin folder. I don't have any computer on which to test it right now but we'll see in the futur deployment if we encounter this problem again. But I don't think we will, thanks a lot!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests