PDA

View Full Version : Global Assembly Cache (GAC)



Unregistered
01-12-2006, 04:44 PM
What are the best practices for installing into the GAC on target machine?

My program uses some 3rd party UI libraries. They all install into the GAC on my development machine. Should I do the same on the target machine, or would I be better off just putting them into the application folder?

If I do install into the GAC, what options should I check on the file details dialog. Obviously the checkbox ".NET assembly", but I mean what about uninstall? Register as shared file? Replacement options?

Unregistered
01-12-2006, 05:11 PM
Uh-oh. I checked the .NET assembly checkbox but the assemblies don't get installed into the GAC. They do get copied into the folder I specify, which I just made up because I thought they would go into the GAC and not be copied into some folder. In Wise, there is a actually a target "folder" named GAC. Just copy files into that.

When I run the program, I get some kind of .NET error about bad image, for one of the assemblies that should be in the GAC (but isn't - I just copied to application folder after the install to see if it would work).

This is getting a little nightmare-ish now.

Unregistered
01-12-2006, 05:19 PM
OK this time I just gave up on the GAC and put those assemblies into the application folder in SetupBuilder, and then recompiled. Same error:

System.BadImageFormatException

I'm no expert on .NET assemblies and the GAC, but the answer to my earlier question about where to install these assemblies that come from my GAC, would appear to be, they are expected to be in GAC on the target computer.

This is so not going well.

Unregistered
01-12-2006, 07:08 PM
Well now I feel a little stupid. I was putting in the wrong assemblies for my application. I was adding the VS 2005 versions. I got confused by the vendor's numbering system for internal version numbers. Never mind!

OK, but there is still a problem. Setupbuilder is copying these assemblies to the GAC. But it's also copying them to the applictation folder. Why?

Seems like what Wise did here was best and have a built-in folder "GAC" and if you drop an assembly there, that's where it goes.

Also it would be nice if the setup program had given an error at runtime when it tried to install a 2.0 assembly to the 1.1 framework GAC.

LSConsulting
01-13-2006, 02:37 AM
Hello,

I am not a .NET expert, but did you check for the .NET Framework version on the destination machine?

Andrew

Unregistered
01-13-2006, 08:59 AM
Hello,

I am not a .NET expert, but did you check for the .NET Framework version on the destination machine?

Andrew

As I said, Setupbuilder is now copying these assemblies to the GAC.

But it's also copying them to the applictation folder. Why? They only need to be put in the GAC. It's a bit funky.

LSConsulting
01-13-2006, 09:10 AM
I thought GAC is only a set of registry entries. I had no idea it's a "physical location".

Just curious. So the files should not be in the Application Folder? Only in the "GAC"? I am learning .NET now.

Andrew

linder
01-13-2006, 09:20 AM
Hello,

Item in review.

Thanks,

linder
01-13-2006, 09:31 AM
Hello,

Just to be on the safe side. Install assemblies to the Global Assembly Cache works (and you can execute your application). The "only" problem is that SetupBuilder installs it into the GAC and the application folder, correct?

Thank you for your time.

Unregistered
01-13-2006, 09:41 AM
Hello,

Just to be on the safe side. Install assemblies to the Global Assembly Cache works (and you can execute your application). The "only" problem is that SetupBuilder installs it into the GAC and the application folder, correct?

Thank you for your time.

That's correct, and sorry for the confusion in the initial post.

This is a minor problem, I guess you could say, but certainly strikes me as pretty funky. If I want to install an assembly to the GAC, why should I create a target folder, to which Setupbuilder also installs the same file?

linder
01-13-2006, 09:45 AM
Hello again :)

Would it be possible for you to send us a screenshot (or post it here) - Application folder and GAC. At the moment we cannot find the "duplicate" files.

Thank you!!!

Unregistered
01-13-2006, 10:30 AM
Hello again :)

Would it be possible for you to send us a screenshot (or post it here) - Application folder and GAC. At the moment we cannot find the "duplicate" files.

Thank you!!!

Ok, let me explain again, because my previous posts I wrote at a late hour.

One of the assemblies that I want to install into the GAC is DevExpress.Utils3.dll. So in the Files screen I need to drag that down from the top half of the screen to the target pane below. Where do I put it? I'll put it in Application Folder. Then I double-click on it to bring up the details dialog, go to Advanced Tab, and check ".NET Assembly".

When I run setup on the target machine, this assembly gets installed into the GAC. (Note that when I tried this with the wrong assembly, there was no error message...see previous post). Great! But...there is also a copy in the application folder on the target machine. I don't need a copy of the assembly there, I'm installing it into the GAC. I only added it to Application Folder because that was the only way I could see to make the assembly part of my setup program and tell SetupBuilder I wanted it installed into the GAC.

Again, this is why I think you should have a special folder in the target pane called (for example) "GAC". When I drag an assembly there, it means I want to install to the GAC. I don't need a separate copy somewhere else on the target machine. This is how Wise does it, and this really does seem an intuitive way to handle the problem to me. But maybe I'm missing something obvious?

linder
01-13-2006, 10:39 AM
At the moment we are not sure if this a bug or a feature or if it is a regression (very complex source code behind-the-scenes). SetupBuilder is able to install both .Net and Win32 assemblies in either Global Assembly Cache (GAC) or privately for a particular application (installing .Net and Win32 assemblies, as side-by-side on Windows XP).

I'll get back to you!

Thanks again for all your time.