Step 2: Place your Assembly in the Bin or Global Assembly Cache

SharePoint 2007

Within a SharePoint site, you can deploy a Web Part assembly to one of two locations:

  1. Bin directory: The bin directory is a folder stored in your Web application root directory. For more information, see How to: Find Your Web Application Root

  2. Global Assembly Cache: The Global Assembly Cache enables you to share assemblies across numerous applications. The Global Assembly Cache is automatically installed with the common language runtime. Components are typically stored in C:\WINNT\Assembly.

Each location has advantages and disadvantages, as described in the following table.

Deployment Location Advantages Disadvantages

Bin directory

A partial trust location. By default, code that runs from this directory has a low level of code access security (CAS) permissions. Administrator must explicitly raise permissions granted to a Web Part so it can function properly. Because of this level of control and defense-in-depth, administrators tend to prefer that assemblies they get can run in the bin directory, with a known set of required CAS permissions.

A bin directory is also specific to a Web application. This makes it possible to isolate code to a particular Web application.

If you want your Web Part to run everywhere, you would need to deploy your bin assembly.

Global assembly cache

A global location where signed assemblies can be deployed. Assemblies run with full trust by default. They are globally installed, so they will work in any Web application.

Generally, there are no CAS restrictions on code installed to the global assembly cache; therefore, you lose the defense-in-depth security benefit.

Also, it can be difficult to deploy your .PDB files (program databases) to assemblies in the global assembly cache.

To keep the procedure simple, this topic assumes that you want to place the assembly in the bin directory.

Create an ASP.NET Web Part assembly, as described in Step 1: Develop an ASP.NET Web Part Assembly.

  • Copy the Web Part assembly (DLLs) in the project's bin directory to the bin directory in your application root. For more information, see How to: Find Your Web Application Root

Community Additions

ADD
Show: