4

Possible Duplicate:
When should I deploy my assemblies into the GAC?

As per MSDN documentation:

You should share assemblies by installing them into the global assembly cache only when you need to. As a general guideline, keep assembly dependencies private, and locate assemblies in the application directory unless sharing an assembly is explicitly required.

When is sharing an assembly "explicitly required"? If assembly sharing is required, you can physically distribute the same assembly on different locations via XCOPY DEPLOYMENT à la Private Assemblies. I don't understand this general guideline.

Community
  • 1
  • 1
Ian
  • 5,625
  • 11
  • 57
  • 93
  • Only in very rare scenarios. If I recall correctly VS plugins needed to be in the GAC. There might be similar issues with plugins for other programs. And perhaps some APTCA scenarios. – CodesInChaos May 10 '11 at 11:22
  • Biztalk also requires assemblies to be deployed to GAC. – Sergio Vicente May 10 '11 at 11:27
  • I am asking about the different scenarios where you will be forced to "explicitly share" an assembly. I am not asking about when to deploy an assembly in the GAC. – Ian May 10 '11 at 12:35
  • Vote to reopen and edited subject. Though the original subject line makes it appear to be a duplicate, it isn't quite a duplicate, since Ian is asking about a specific point in the MSDN documentation. – Brian May 10 '11 at 18:43

1 Answers1

0

A general rule I tend to follow is that if an assembly is going to be used by multiple applications on the same machine it should go in the GAC i.e. you have built your own Framework of useful code.

If you just have one application it is normally best to just use the bin folder.

Take note if you want to deploy to GAC you need to sign (with a strong name key) and version your assemblies.

Burt
  • 7,680
  • 18
  • 71
  • 127
  • 2
    That an assembly is shared between a few of your applications is no good reason IMO. – CodesInChaos May 10 '11 at 11:23
  • I don't know, you could argue for and against. Should a framework such as the Enterprise Library get deployed to the GAC? I suppose it really depends on each individual case, would you agree with that? – Burt May 10 '11 at 11:37
  • 1
    @CodeInChaos This is exactly where at. Multiple applications are sharing an assembly. We can just duplicate the physical copy across different directories (private assemblies) or we can use the GAC. Why is "sharing" a good reason to use the GAC? – Ian May 10 '11 at 12:30
  • Personally I try to avoid the GAC and haven't had much use for it in 10 years .Net development (Windows and ASP.Net), that is not to say it doesn't have it's uses. Technically speaking and as a lot of documentation points out the GAC is for Sharing assemblies between applications. – Burt May 10 '11 at 12:45
  • When sharing a library I'd most likely use a symlink or just copy them, depending on which versioning semantics I want. – CodesInChaos May 10 '11 at 13:01