There are two ways to remove trust from folders and assemblies in Visual Studio Tools for Office projects:

Delete the code group that grants the permissions from the Microsoft .NET Framework security policy.

Set the properties of the code group so that it grants no permissions.

Removing permissions does not take effect immediately. All users must quit and then restart all Office applications before security policy changes are enforced. Check Task Manager to ensure there are no instances of Microsoft Office applications. Other applications that host Microsoft Office applications can also prevent the new permissions from being enforced. Users should quit all applications that use Microsoft Office, hosted or stand-alone, when security policies are changed.

To remove permissions by deleting code groups

In Control Panel, open Administrative Tools.

Run Microsoft .NET Framework 2.0 Configuration.

The Microsoft .NET Framework 2.0 Configuration tool is not included with Visual Studio 2008. To install the tool, you must download and install the .NET Framework 2.0 Software Development Kit (SDK) from the Microsoft Download Center. For an example, see .NET Framework 2.0 Software Development Kit (SDK) (x86).

If you want to modify a network location such as a share or a Web site, you do the modification at the Machine level instead of the User level. You must have administrator privileges to modify Machine-level policy.

Select the code group that you want to remove.

On the Action menu, click Delete.

You can also delete the entire VSTOProjects node and all its contents, so that no Office solutions that use managed code extensions can run. A new VSTOProjects node is created the next time you build a Visual Studio Tools for Office project.

Note:

If you delete a code group that Visual Studio generated, the code group will be regenerated the next time you open the project and rebuild it. If you delete the code group while the project is open, Visual Studio will not regenerate the code group until you close the project and then reopen it.

To remove permissions by changing code group properties

Expand the VSTOProjects node as described above.

Right-click the code group you want to change, and then click Properties on the shortcut menu.

In the Properties dialog box, click the Permission Set tab.

Select Nothing in the Permission Set list.

Note:

Any permission set that is not FullTrust prevents the assembly from running.