20.10 Installing Assemblies into the Global Assembly Cache

 <  Day Day Up  >  

You want to install one or more assemblies as shared assemblies into the global assembly cache ( GAC ).


Technique

Add the primary output of the relevant projects into the Application Folder virtual folder in the File System Editor. Right-click on the root File System on Target Machine node in this editor and select Add Special Folder from the context menu. You see a list of possible virtual folders, and you should choose Global Assembly Cache Folder from this list. You then see the GAC appear as an additional virtual folder in the File System Editor's treeview, as shown in Figure 20.19.

Figure 20.19. File System Editor with the GAC added.

graphics/20fig19.gif

Now simply select the projects whose primary outputs you want to install as shared assemblies under the Application Folder, and use the mouse to drag and drop them into the Global Assembly Cache Folder. Note that each of these assemblies must have been signed with a strong name ; otherwise , you get a build error when you next build the setup project.

Comments

One disadvantage of using a setup project here is that it is necessary for the developer to have access to the private key to be able to sign the code. It is possible to work around this requirement, but the workarounds are awkward . Perhaps the easiest way is to code the assemblies that are to be shipped as shared assemblies in one or more completely separate projects and install them as shared assemblies on the developer machine. Then, have the setup project reference these assemblies as prebuilt assemblies rather than as project outputs. When these assemblies are ready to be shipped, they can be signed by the security manager and reinstalled in the developer machine GAC, and the setup project can be rebuilt to reference the signed assemblies.

Also, bear in mind that when you move project outputs in the File System Editor from the Application Folder to the GAC, VS.NET examines the dependencies of the various projects. If it detects that other projects depend on the moved assemblies, it leaves unnecessary copies of them in the Application Folder, which cannot be deleted within the setup project. Having said that, these extra copies are in most cases harmless ”other than the waste of disk space on the target machine.

 <  Day Day Up  >  


Microsoft Visual C# .Net 2003
Microsoft Visual C *. NET 2003 development skills Daquan
ISBN: 7508427505
EAN: 2147483647
Year: 2003
Pages: 440

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net