mylifeinaminute.com

Custom Web Parts and Local Deployments

by liquidpooled on Apr.23, 2008, under Microsoft, Office, Sharepoint Server, Visual Studio 2005

When trying to deploy your web parts the “right” way (local content deployment, bin directory, etc.) one issue that can crop up deals with the actual compilation of your custom web part.

If you receive the following error message:

Unable to add selected web part(s).
<Web Part Name>: Assemblies that implement ASP.NET Web Parts and are installed into a partially trusted location, such as the bin directory, must be compiled with the AllowPartiallyTrustedCallersAttribute set for import to succeed.

then you need to add a line to your AssemblyInfo.cs such as the following:


[assembly: System.Security.AllowPartiallyTrustedCallers()]

A good primer on the attribute can be found here.

No comments for this entry yet...

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...