Поделиться через


How to: Add and Remove Additional Assemblies

If a SharePoint package depends on other assemblies for functionality or data, you can add the assemblies to your solution package (.wsp). This way, the SharePoint server makes sure that custom assemblies are installed with a package.

You can also add and change the safe controls and class resource files associated with the assemblies.

Adding Additional Assemblies, Safe Controls, and Class Resources

You can add additional assemblies into the SharePoint solution package. Additional assemblies in a sandboxed solution deploy to the global assembly cache, but SharePoint project items in a sandboxed solution are added to the content database. You can also add safe controls and class resources to these additional assemblies. For more information about safe controls, see “Creating a SafeControl Entry” in Deploying Web Parts in SharePoint Foundation.

To add an existing assembly

  1. Open the Package Designer. For more information, see How to: Customize a SharePoint Solution Package.

  2. Click the Advanced tab.

  3. Click the Add button, and then click Add Existing Assembly.

    The Add Existing Assembly dialog box appears.

  4. Click the ellipsis (ASP.NET Mobile Designer ellipse), and select the assembly that you want to add. We recommend using a relative path to the selected assembly for portability purposes.

  5. For the Deployment Target, click GlobalAssemblyCache to deploy the assembly to the global assembly cache, or click WebApplication to deploy the assembly to the WebApplication folder on the SharePoint server.

To add an assembly from project output

  1. Open the Package Designer. For more information, see How to: Customize a SharePoint Solution Package.

  2. Click the Advanced tab.

  3. Click the Add button, and then click Add Assembly from Project Output.

    The Add Assembly from Project Output dialog box appears.

  4. Click the drop-down menu, and select the source project that you want to add.

  5. For the Deployment Target, click GlobalAssemblyCache to deploy the assembly to the global assembly cache, or click WebApplication to deploy the assembly to the WebApplication folder on the SharePoint server.

To add a safe control

  1. Open the Edit Existing Assembly dialog box. To accomplish this, open the Package Designer, click the Advanced tab, select an assembly, and then click Edit.

  2. In the Safe Controls pane, click Click here to add a new item.

  3. In the Assembly Name column, type the name of the assembly.

  4. In the Namespace column, type the name of the namespace for the safe control.

  5. In the Type Name column, type the name of the type.

To add a class resource

  1. Open the Edit Existing Assembly dialog box. To accomplish this, open the Package Designer, click the Advanced tab, select an assembly, and then click Edit.

  2. In the Class Resources pane, click Click here to add a new item.

  3. In the File Name column, click the ellipsis (ASP.NET Mobile Designer ellipse), and select the class resource that you want to add.

Deleting Custom Assemblies

You can delete assemblies from a SharePoint package, or delete safe controls and class resources from existing assemblies.

To delete an existing assembly

  1. Open the Package Designer. For more information, see How to: Customize a SharePoint Solution Package.

  2. Click the Advanced tab.

  3. In the Additional Assemblies pane, click the custom assembly that you want to delete.

  4. Click the Delete button.

To delete a safe control for an assembly

  1. Open the Edit Existing Assembly dialog box. To accomplish this, open the Package Designer, click the Advanced tab, select an assembly, and then click Edit.

  2. Click the safe control that you want to delete.

  3. Press the Delete key on the keyboard.

To delete a class resource for an assembly

  1. Open the Edit Existing Assembly dialog box. To accomplish this, open the Package Designer, click the Advanced tab, select an assembly, and then click Edit.

  2. Click the class resource that you want to delete.

  3. Press the Delete key on the keyboard.

See Also

Tasks

How to: Customize a SharePoint Feature

How to: Add and Remove Items to SharePoint Features

Other Resources

Creating SharePoint Features

How to: Modify Feature Properties