Redistributing GdPicture.NET with VB6/ActiveX

Discussions about GdPicture.NET usage in non managed applications built in vb6, Delphi, vfp, MFC c++ etc...
Post Reply
OddsInc
Posts: 13
Joined: Thu May 01, 2014 6:25 pm

Redistributing GdPicture.NET with VB6/ActiveX

Post by OddsInc » Fri May 02, 2014 8:33 pm

Hello,

Have read all the available documentation related to deploying the libraries (I think).
I just want to make sure I understand how it all should be done.
We are using a VB6 and ActiveX environment.


Using 32bit vs 64bit dll libraries:
What determines which version should be deployed/registered?
Is it the version of the "application" being deployed or the version of the "OS" on the target machine?
Since we are using VB6, our application will always be 32bit although it might be installed on either 32bit or 64bit OS.


Which dll libraries should be used:
After installing GdPicture, there are several dll libraries in the Redist folder.
In the "COM Interop" folder there is only the GdPicture.NET.10.dll
(plus the GdPicture.NET.10.tlb generated during registration and the registration files).
Are we supposed to copy the appropriate 32bit or 64bit dll libraries in "Redist" into the "COM Interop" folder?

What about the various "Framework x.x" folders in "Redist"?
There are a few dll libraries in there as well (GdPicture.NET.10.dll plus some barcode writer, PDF and a .xml).
Do any of those need to be copied/used and for what situations?


Where should the dll libraries be installed:
It appears that we can place the dll's pretty much anywhere, preferrably in the same directory as the application.
Our application executable resides on a "Network File Server" and is executed from there, not from the target machine.
Should the dll libraries be installed on/registered from a location on the target machine?
Can the dll libraries be loaded from and registered from the location where they reside on the Network file server?


Help with any of the above is greatly appreciated.

Rick Naff
Old Dominion Data Systems

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Redistributing GdPicture.NET with VB6/ActiveX

Post by SamiKharma » Mon May 05, 2014 1:31 pm

Hi,

All the questions are answered in the redistribution section. Here are the answers you are seeking.

Using 32bit vs 64bit dll libraries:
What determines which version should be deployed/registered?
Is it the version of the "application" being deployed or the version of the "OS" on the target machine?
>>Simply if your application is 64 bit based, it will work on 64 bit OS, thus deploy that, the obvious is true except that 32 bit will also run on 64 bit.


Which dll libraries should be used:
After installing GdPicture, there are several dll libraries in the Redist folder.
Are we supposed to copy the appropriate 32bit or 64bit dll libraries in "Redist" into the "COM Interop" folder?
>> this is answered here: "https://www.gdpicture.com/guides/gdpicture/Red ... e.NET.html" section Redistributing required files.

What about the various "Framework x.x" folders in "Redist"?
>> Depends on what .NET framework your application is using and aimed to.

There are a few dll libraries in there as well (GdPicture.NET.10.dll plus some barcode writer, PDF and a .xml).
Do any of those need to be copied/used and for what situations?
>>You copy them if you are referencing them in your application, basically, if you are using them.


Where should the dll libraries be installed:
>> They have to be in a place where the application can see them, i.e, next to the exe, or in a folder that is an environment path, or registered in the GAC, whatever you perfer.

Best,
Sami

OddsInc
Posts: 13
Joined: Thu May 01, 2014 6:25 pm

Re: Redistributing GdPicture.NET with VB6/ActiveX

Post by OddsInc » Wed May 07, 2014 3:46 pm

Thanks Sami,

That cleared up most of my questions:

Since we are using VB6 (32bit) then it seems that distributing just the 32bit libraries make things simpler for us.

Other than the fact that we are using GdPicture, we are not using the .NET framework directly in our application...
I understand about the PDF and Barcode writer libraries found in the Framework.x.x directories.
Since we are using the COM edition, we would use those found in the Framework.2.0 (based on the documentation).
But what about the GdPicture.NET.10.dll in that directory?

I did some testing related to that...
I unregistered the libraries.
Deleted the GdPicture.NET.10.tlb
Then copied the GdPicture.NET.10.dll from Framework.2.0 into the COM Interop directory and registered.
The GdPicture.NET.10.tlb was much smaller than before and our application did not work.
Just not sure about that or why the GdPicture.NET.10.dll is present in the Framework.x.x directories.


One last thing related to "where" we deploy the dll libraries...
I would like to have the GdPicture libraries on the Network File Server and loaded from there just as our application is.
But not necessarily in the same folder as where our application is.
So if I put all the related GdPicture libraries in the same directory as where GdPicture.NET.10.dll is registered, is that what you mean by "registered in the GAC"?
I also saw a comment about using CasPol.exe when installing the libraries on a network location. Does that apply?


Please excuse all the questions, but I have limited experience with the rules and regulations of .NET and also am fairly new to the game as it relates to GdPicture. Although our application is working just fine at our office on our development machine, I don't want the deployment to fail because I missed some minute detail.

Thanks so much for any help you can provide.

Rick Naff
Old Dominion Data Systems

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

Re: Redistributing GdPicture.NET with VB6/ActiveX

Post by Cedric » Mon May 12, 2014 2:02 pm

Hi Rick,

Indeed, using VB6 the process will be 32-bit so even on a 64-bit operating system there is no need to deploy 64-bit runtime libraries.
The reason why you cannot use GdPicture.NET.10.dll from another folder than COM Interop is because they are not compiled to be accessed as COM components.
Only GdPicture.NET.10.dll that is on COM Interop folder is, that's why there is a lot missing in the TLB (hence the size) and your application cannot work anymore.

About the deployment location now, GdPicture.NET main assembly (GdPicture.NET.10.dll) and the dedicated PDF assembly will install in GAC for sure, however our SDK is not 100% pure .NET (which is required for GAC registration) because some of our dependencies are developed using low level C++ for memory management and performances issues, this cannot go to the GAC as it is not .NET technology.
It is indeed possible to deploy the libraries in a different folder than the application executable.
However I would not recommend it because that would require you to alter the system the application will be deployed to as you will need to either add an entry in the PATH system variable pointing to the folder where GdPicture.NET redistributable files are or put them into a folder that is already part of the PATH system variable (C:\Windows\System32 for instance, which is a VERY bad idea).

If you want to deploy from a network location, you need to know that you cannot load .NET assemblies from network shares without first changing the security policy about it.
Network shares get “LocalIntranet” permission by default so you indeed need to use the Code Access Security Policy tool (Caspol.exe) first to grant full trust on network shares.
To grant trust to a network location, you must have administrator privileges and change the security policy at the Machine level.
As it is a major policy change that can be a potential security breach, I strongly advise that you contact the local sys/network administrator to make sure it is possible before going that way.

To trust everything on the share \\server\share, the command is : CasPol.exe -m -pp off -ag 1.2 -url file://///server/share/* FullTrust
And it reads the following:
-m = modify the machine level of the policy
-pp off = turns the confirmation prompt off (may be useful in an automated deployment process)
-ag 1.2 = add a code group under group 1.2. In the default policy, group 1.2 is the “LocalIntranet” group, so the new code group that we're creating will only be checked if the file comes from the intranet.
-url file://///server/share/* = The membership condition for the new code group is should be a UrlMembershipCondition, if you use a mapped network drive, let's say Z:, then simply replace file://///server/share/* with "file:///Z:/*"
FullTrust = The permission set to grant assemblies that match the code group.

Of course this example should not be used as is since it grants full access to everything in a folder (and it is a bad practice) and needs to be adapted to your own situation, but you get the idea.
Here is the complete reference of the Code Access Security Policy Tool from MSDN

In addition, if you are running a 64-bit system, you should probably make sure to run caspol.exe on the 32-bit version and not the 64-bit version of the framework as both are provided.
FYI, the 32-bit folder is in C:\Windows\Microsoft.NET\Framework\v2.0.50727 when the 64-bit one is C:\Windows\Microsoft.NET\Framework64\v2.0.50727

I hope these information will shed some light on the subject, if you need further explanations or assistance, feel free to ask we're here to help you!

Cheers!

OddsInc
Posts: 13
Joined: Thu May 01, 2014 6:25 pm

Re: Redistributing GdPicture.NET with VB6/ActiveX

Post by OddsInc » Mon May 12, 2014 6:01 pm

Hi Cedric!

That's exactly what I was looking for!

Considering the wealth of information you shared and after doing some testing with various deployments...
I have decided to go with the "path" of least resistance, and NOT deploy/register the libraries from the file server.
As much as I want to miminize the footprint, it's just not worth the extra configuration hassles.

That leaves us with "where" the libraries will be installed on the workstations:
We have multiple applications where the executables are in "different" folders.
They all "share" GdPicture and some other third party libraries deployed with our application.
Don't really want to have multiple copies floating around, so we put all third party libraries in a common folder.

Based on my testing...
It appears that if all the libaries are in the same folder as where GdPicture.NET.10.dll gets registered, all is good.
Did some test installs, and everything works as it should with the libaries NOT being in the executable folder.
I did NOT add anything to the "Path" variable either, so that is one requirement tid bit that I question.

Thanks so much for the help!

Rick Naff
Old Dominion Data systems

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

Re: Redistributing GdPicture.NET with VB6/ActiveX

Post by Cedric » Mon May 12, 2014 6:09 pm

You're welcome Rick, I think you made the wisest choice here, registering ActiveX components from a network share is almost always a bad idea, Windows usually don't like it that much and it can easily break without notice.

About the folder question what I said was generally speaking, it was including .NET deployment as well and not only the COM interop specificity.
But since there is COM registration underneath here, I guess the system is able to locate the files by himself provided they are in the same folder as the main assembly (which is the case).
This is probably the best choice here too because of the version multiplication that often lead to mismatch between updates and when everything is broken it is really hard to fix.

I wish you good luck with your deployment!

Cheers!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest