<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.dotnetmafia.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Corey Roth [MVP] : Deployment</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Deployment/default.aspx</link><description>Tags: Deployment</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>Making changes to SharePoint the quick and dirty way (Ghetto Deployment)</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/08/05/making-changes-to-sharepoint-the-quick-and-dirty-way-ghetto-deployment.aspx</link><pubDate>Wed, 05 Aug 2009 16:04:06 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:947</guid><dc:creator>CoreyRoth</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dotnetmafia.com/blogs/dotnettipoftheday/rsscomments.aspx?PostID=947</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/08/05/making-changes-to-sharepoint-the-quick-and-dirty-way-ghetto-deployment.aspx#comments</comments><description>&lt;p&gt;So you become a pro SharePoint developer, you’re great at making &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/10/22/intro-to-sharepoint-development-how-to-build-and-deploy-a-web-part.aspx"&gt;solution packages&lt;/a&gt;, but now you’re feeling lazy and want to cut out a few steps when you’re just making some changes during development.&amp;#160; This post is for you.&amp;#160; In reality, the best way to deploy your web parts and other custom code is using a solution package with a feature.&amp;#160; Deploying solution packages can take quite a bit of time.&amp;#160; If you’re just changing one line of code, do you really need to go through the hassle of deploying a solution package every time?&amp;#160; The answer is in fact no as long as you are careful and are willing to deal with the consequences should anything go wrong.&amp;#160; Most of the scenarios we are talking about today assume you have a solution package built and you have deployed it at least once.&amp;#160; We’re just talking about how you can make development faster on subsequent code changes.&lt;/p&gt;  &lt;p&gt;One thing I will point out before we start is that if you are in a farm environment, your changes must be deployed to all front end servers.&lt;/p&gt;  &lt;h5&gt;Web Parts&lt;/h5&gt;  &lt;p&gt;Updating a web part is pretty simple.&amp;#160; All you need to do is copy the assembly to wherever you deployed it to (GAC or bin folder).&amp;#160; Your .webpart file does not need to be updated unless you have made changes to it.&lt;/p&gt;  &lt;h5&gt;Web Parts Deployed to the GAC&lt;/h5&gt;  &lt;p&gt;Although, I try to put as little in the GAC as possible, some things just have to go there.&amp;#160; If you have made a change to your web part’s code, you can easily just copy the assembly out of your project and put it straight in the GAC via the C:\Windows\Assembly folder.&amp;#160; Don’t forget that SharePoint caches assemblies in the Global Assembly Cache, so you need to recycle your application pool of any web application that is using your web part on each front end server.&amp;#160; You can just do an iisreset, but an application pool reset is a bit faster.&lt;/p&gt;  &lt;h5&gt;Web Parts Deployed to the bin folder&lt;/h5&gt;  &lt;p&gt;If you are deploying to the bin folder, ghetto deployment is even easier.&amp;#160; Just copy out the DLL to the bin folder of your web application and you are good to go.&amp;#160; No application pool reset is necessary.&amp;#160; If you do make significant changes and your code requires different permissions, then you will need to deploy with your solution package so that you can specify an updated CAS policy.&lt;/p&gt;  &lt;h5&gt;Pages and User Controls&lt;/h5&gt;  &lt;p&gt;If your code behind changes, then the rules above for web parts apply.&amp;#160; Just copy out the binary to the deployment location.&amp;#160; If you made changes to a .aspx or .ascx file, these files can simply be copied out to the 12 hive (LAYOUTS folder for pages and CONTROLTEMPLATES folder for controls).&lt;/p&gt;  &lt;h5&gt;Event Receivers&lt;/h5&gt;  &lt;p&gt;The binaries for your event receivers can also be copied out directly to the GAC.&amp;#160; Just like with web parts, remember to reset your application pool to avoid caching issues.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Workflow&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Workflow can also be deployed directly to the GAC.&amp;#160; If you have any changes to what forms are registered or anything else you will need to deploy it regularly though.&lt;/p&gt;  &lt;p&gt;Some of this may have seemed obvious, but I have had a few developers ask me questions like this when starting out.&amp;#160; Of course if anyone goes wrong, just start open, retract your solution and redeploy it the correct way.&amp;#160; Hopefully, though you can use some of these tips to speed up development when you are making lots of changes.&amp;#160; No one likes to sit there and wait for a solution to deploy.&amp;#160; Have any other tips?&amp;#160; Leave a comment.&lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=947" width="1" height="1"&gt;</description><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Deployment/default.aspx">Deployment</category></item><item><title>How to: Deploy a Page using a Feature</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/06/02/how-to-deploy-a-page-using-a-feature.aspx</link><pubDate>Tue, 02 Jun 2009 20:58:23 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:917</guid><dc:creator>CoreyRoth</dc:creator><slash:comments>19</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dotnetmafia.com/blogs/dotnettipoftheday/rsscomments.aspx?PostID=917</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/06/02/how-to-deploy-a-page-using-a-feature.aspx#comments</comments><description>&lt;p&gt;I am about to do start giving some training again, so I thought I would work on some more content for the blog that I could refer to people to when they are trying things out.&amp;#160; Today, I want to start out with the basic task of deploying a page to SharePoint.&amp;#160; There are actually lots of ways to get pages into SharePoint.&amp;#160; You can use the whole page publishing model in MOSS, but sometimes you just need a simple page with a simple web part deployed and a feature makes this task pretty easy.&lt;/p&gt;  &lt;p&gt;For today’s example, I want to deploy a simple page with a web part or two on it.&amp;#160; To start, you will need to create a new folder for your feature.&amp;#160; You can name this whatever you want.&amp;#160; For the purpose of this example, we’ll call it &lt;em&gt;PageTest&lt;/em&gt;.&amp;#160; Before we begin though we need a .aspx page which will host these web parts.&amp;#160; You can create one on your own, but I find it’s easiest to just “borrow” one from SharePoint that already exists.&amp;#160; A good one to borrow I have found is in the STS site template (12\TEMPLATE\SiteTemplate\STS) called default.aspx.&amp;#160; This .aspx page has two WebPartZones named &lt;em&gt;Left&lt;/em&gt; and &lt;em&gt;Right&lt;/em&gt;.&amp;#160; Put a copy of this file into your new feature folder.&amp;#160; You can customize this file however you desire, such as changing the layout or adding or subtracting WebPartZones.&lt;/p&gt;  &lt;p&gt;By now, I am sure you probably know how to make a basic Feature.xml file, but here is one just in case.&amp;#160; In this case, we have a feature with a scope of &lt;em&gt;Web&lt;/em&gt; so we’ll be deploying to an individual site.&lt;/p&gt;  &lt;div style="font-family:consolas;background:black;color:white;font-size:13pt;font-weight:bold;"&gt;   &lt;p style="margin:0px;"&gt;&amp;lt;&lt;span style="color:#cc7832;"&gt;Feature&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:silver;"&gt;xmlns&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;http://schemas.microsoft.com/sharepoint/&lt;/span&gt;&amp;quot;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:silver;"&gt;Id&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;{8B486B2B-4D71-423f-BD6C-9C792299F432}&lt;/span&gt;&amp;quot;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:silver;"&gt;Scope&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;Web&lt;/span&gt;&amp;quot;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:silver;"&gt;Hidden&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;False&lt;/span&gt;&amp;quot;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:silver;"&gt;Title&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;PageTest&lt;/span&gt;&amp;quot;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:silver;"&gt;Description&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;Deploys a custom page with some web parts.&lt;/span&gt;&amp;quot;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160; &amp;lt;&lt;span style="color:#cc7832;"&gt;ElementManifests&lt;/span&gt;&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;span style="color:#cc7832;"&gt;ElementManifest&lt;/span&gt; &lt;span style="color:silver;"&gt;Location&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;elements.xml&lt;/span&gt;&amp;quot; /&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160; &amp;lt;/&lt;span style="color:#cc7832;"&gt;ElementManifests&lt;/span&gt;&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;lt;/&lt;span style="color:#cc7832;"&gt;Feature&lt;/span&gt;&amp;gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;The Elements.xml file deploys files using the &lt;em&gt;Module&lt;/em&gt; and &lt;em&gt;File&lt;/em&gt; elements.&amp;#160; The &lt;em&gt;Module&lt;/em&gt; element tells SharePoint to deploy files from a physical folder, specified in the &lt;em&gt;Path&lt;/em&gt; attribute, to a virtual folder inside SharePoint, specified in the &lt;em&gt;Url&lt;/em&gt; attribute.&amp;#160; The Path attribute is relative to the feature folder while the &lt;em&gt;Url &lt;/em&gt;attribute is relative to the site it was deployed on.&amp;#160; No paths are specified in our case.&lt;/p&gt;  &lt;div style="font-family:consolas;background:black;color:white;font-size:13pt;font-weight:bold;"&gt;   &lt;p style="margin:0px;"&gt;&amp;lt;&lt;span style="color:#cc7832;"&gt;Module&lt;/span&gt; &lt;span style="color:silver;"&gt;Name&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;Pages&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;Path&lt;/span&gt;=&amp;quot;&amp;quot; &lt;span style="color:silver;"&gt;Url&lt;/span&gt;=&amp;quot;&amp;quot;&amp;gt;&lt;/p&gt; &lt;/div&gt;   &lt;p&gt;The Module element can contain one or more &lt;em&gt;File&lt;/em&gt; elements to deploy pages.&amp;#160; You need one File element for each page you want to deploy inside of SharePoint.&amp;#160; Note: that it is possible to use the same default.aspx page in your feature folder and deploy it multiple times with different web parts (i.e.: page1.aspx, page2.aspx, etc.).&lt;/p&gt;  &lt;div style="font-family:consolas;background:black;color:white;font-size:13pt;font-weight:bold;"&gt;   &lt;p style="margin:0px;"&gt;&amp;lt;&lt;span style="color:#cc7832;"&gt;File&lt;/span&gt; &lt;span style="color:silver;"&gt;Name&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;TestPage.aspx&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;Url&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;default.aspx&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;IgnoreIfAlreadyExists&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;FALSE&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;NavBarHome&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;True&lt;/span&gt;&amp;quot;&amp;gt;&lt;/p&gt; &lt;/div&gt;   &lt;p&gt;The &lt;em&gt;Name&lt;/em&gt; attribute specifies the name the file will be called inside SharePoint.&amp;#160; The &lt;em&gt;Url&lt;/em&gt; specifies the name of the file in your feature folder.&amp;#160; In our case, default.aspx.&amp;#160; The confusing part her of course being that Url in the Module element refers to the path inside SharePoint and on the File element it refers to the name of the file in your feature folder.&lt;/p&gt;  &lt;p&gt;For each page that you can deploy, you can use CAML to automatically add web parts to the page.&amp;#160; To do this, you use the &lt;em&gt;AllUsersWebPart&lt;/em&gt; element.&amp;#160; Remember in the page we had WebPartZones named &lt;em&gt;Left &lt;/em&gt;and &lt;em&gt;Right&lt;/em&gt;?&amp;#160; We use those same Ids here, to specify which zone to add the web part too.&amp;#160; The &lt;em&gt;WebPartZoneOrder &lt;/em&gt;element specifies the order in which the web parts are added to a given zone (you can have multiple web parts in a zone and they will stack).&amp;#160; The definition of the web part goes inside a CDATA element inside the AllUsersWebPart element.&amp;#160; If you built the web part yourself, you can just paste in the XML from your .webpart file.&amp;#160; If you are using an out-of-the-box SharePoint web part, you can add it to an existing page and export it or go to the web part gallery and export it.&amp;#160; Here is what a completed file looks like with multiple web parts.&lt;/p&gt;  &lt;div style="font-family:consolas;background:black;color:white;font-size:13pt;font-weight:bold;"&gt;   &lt;p style="margin:0px;"&gt;&amp;lt;&lt;span style="color:#cc7832;"&gt;Elements&lt;/span&gt; &lt;span style="color:silver;"&gt;xmlns&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;http://schemas.microsoft.com/sharepoint/&lt;/span&gt;&amp;quot;&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160; &amp;lt;&lt;span style="color:#cc7832;"&gt;Module&lt;/span&gt; &lt;span style="color:silver;"&gt;Name&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;Pages&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;Path&lt;/span&gt;=&amp;quot;&amp;quot; &lt;span style="color:silver;"&gt;Url&lt;/span&gt;=&amp;quot;&amp;quot;&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;span style="color:#cc7832;"&gt;File&lt;/span&gt; &lt;span style="color:silver;"&gt;Name&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;TestPage.aspx&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;Url&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;default.aspx&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;IgnoreIfAlreadyExists&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;FALSE&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;NavBarHome&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;True&lt;/span&gt;&amp;quot;&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;span style="color:#cc7832;"&gt;AllUsersWebPart&lt;/span&gt; &lt;span style="color:silver;"&gt;WebPartZoneID&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;Left&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;WebPartOrder&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;1&lt;/span&gt;&amp;quot;&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;![CDATA[&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;webParts&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;webPart xmlns=&amp;quot;http://schemas.microsoft.com/WebPart/v3&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;metaData&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;type name=&amp;quot;MyWebPart.TestWebPart, MyWebPart, Version=1.0.0.0, Culture=neutral&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;importErrorMessage&amp;gt;Cannot import this Web Part.&amp;lt;/importErrorMessage&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/metaData&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;data&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;properties&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;property name=&amp;quot;Title&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;My Web Part&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;property name=&amp;quot;Description&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;A test web part.&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/properties&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/data&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/webPart&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/webParts&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;]]&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;span style="color:#cc7832;"&gt;AllUsersWebPart&lt;/span&gt;&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;span style="color:#cc7832;"&gt;AllUsersWebPart&lt;/span&gt; &lt;span style="color:silver;"&gt;WebPartZoneID&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;Left&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;WebPartOrder&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;2&lt;/span&gt;&amp;quot;&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;![CDATA[&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;WebPart xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot; xmlns:xsd=&amp;quot;http://www.w3.org/&lt;/span&gt;&lt;span style="color:silver;"&gt;2001/XMLSchema&amp;quot; xmlns=&amp;quot;http://schemas.microsoft.com/WebPart/v2&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;Title&amp;gt;Search Box&amp;lt;/Title&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;Description&amp;gt;Used to search document and items.&amp;lt;/Description&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;MissingAssembly&amp;gt;Cannot import this Web Part.&amp;lt;/MissingAssembly&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;Assembly&amp;gt;Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=7&lt;/span&gt;&lt;span style="color:silver;"&gt;1e9bce111e9429c&amp;lt;/Assembly&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;TypeName&amp;gt;Microsoft.SharePoint.Portal.WebControls.SearchBoxEx&amp;lt;/TypeName&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;GoImageUrl xmlns=&amp;quot;urn:schemas-microsoft-com:SearchBoxEx&amp;quot;&amp;gt;/_layouts/images/gosearch.gif&amp;lt;/G&lt;/span&gt;&lt;span style="color:silver;"&gt;oImageUrl&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;GoImageUrlRTL xmlns=&amp;quot;urn:schemas-microsoft-com:SearchBoxEx&amp;quot;&amp;gt;/_layouts/images/goRTL.gif&amp;lt;/G&lt;/span&gt;&lt;span style="color:silver;"&gt;oImageUrlRTL&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;GoImageActiveUrl xmlns=&amp;quot;urn:schemas-microsoft-com:SearchBoxEx&amp;quot;&amp;gt;/_layouts/images/gosearch.&lt;/span&gt;&lt;span style="color:silver;"&gt;gif&amp;lt;/GoImageActiveUrl&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;GoImageActiveUrlRTL xmlns=&amp;quot;urn:schemas-microsoft-com:SearchBoxEx&amp;quot;&amp;gt;/_layouts/images/goRTL.&lt;/span&gt;&lt;span style="color:silver;"&gt;gif&amp;lt;/GoImageActiveUrlRTL&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;DropDownModeEx xmlns=&amp;quot;urn:schemas-microsoft-com:SearchBoxEx&amp;quot;&amp;gt;ShowDD&amp;lt;/DropDownModeEx&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;ScopeDisplayGroupName xmlns=&amp;quot;urn:schemas-microsoft-com:SearchBoxEx&amp;quot;&amp;gt;Search Dropdown&amp;lt;/Scop&lt;/span&gt;&lt;span style="color:silver;"&gt;eDisplayGroupName&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;RegisterStyles xmlns=&amp;quot;urn:schemas-microsoft-com:SearchBoxEx&amp;quot;&amp;gt;true&amp;lt;/RegisterStyles&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;ShouldTakeFocusIfEmpty xmlns=&amp;quot;urn:schemas-microsoft-com:SearchBoxEx&amp;quot;&amp;gt;false&amp;lt;/ShouldTakeFoc&lt;/span&gt;&lt;span style="color:silver;"&gt;usIfEmpty&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/WebPart&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;]]&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;span style="color:#cc7832;"&gt;AllUsersWebPart&lt;/span&gt;&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;span style="color:#cc7832;"&gt;AllUsersWebPart&lt;/span&gt; &lt;span style="color:silver;"&gt;WebPartZoneID&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;Right&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;WebPartOrder&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;1&lt;/span&gt;&amp;quot;&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;![CDATA[&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;WebPart xmlns=&amp;quot;http://schemas.microsoft.com/WebPart/v2&amp;quot; xmlns:iwp=&amp;quot;http://schema&lt;/span&gt;&lt;span style="color:silver;"&gt;s.microsoft.com/WebPart/v2/Image&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;Assembly&amp;gt;Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKey&lt;/span&gt;&lt;span style="color:silver;"&gt;Token=71e9bce111e9429c&amp;lt;/Assembly&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;TypeName&amp;gt;Microsoft.SharePoint.WebPartPages.ImageWebPart&amp;lt;/TypeName&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;FrameType&amp;gt;None&amp;lt;/FrameType&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;Title&amp;gt;$Resources:wp_SiteImage;&amp;lt;/Title&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;iwp:ImageLink&amp;gt;/_layouts/images/homepage.gif&amp;lt;/iwp:ImageLink&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;iwp:AlternativeText&amp;gt;$Resources:core,sitelogo_wss;&amp;lt;/iwp:AlternativeText&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/WebPart&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:silver;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;]]&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;span style="color:#cc7832;"&gt;AllUsersWebPart&lt;/span&gt;&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;span style="color:#cc7832;"&gt;File&lt;/span&gt;&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160; &amp;lt;/&lt;span style="color:#cc7832;"&gt;Module&lt;/span&gt;&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;lt;/&lt;span style="color:#cc7832;"&gt;Elements&lt;/span&gt;&amp;gt;&lt;/p&gt; &lt;/div&gt;   &lt;p&gt;When SharePoint is deploying the page, it combines your .aspx page with what is in the elements.xml file to output the completed page.&amp;#160; At this point you are ready to install and activate your feature.&amp;#160; You can put this in a &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/10/22/intro-to-sharepoint-development-how-to-build-and-deploy-a-web-part.aspx"&gt;solution package&lt;/a&gt; at this point to ease deployment.&amp;#160; When you activate the feature, you should get something that looks like this.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/FileDeployment_59025F76.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="FileDeployment" border="0" alt="FileDeployment" src="http://www.dotnetmafia.com/blogs/dotnettipoftheday/FileDeployment_thumb_5EDD030F.png" width="614" height="185" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Of course, deactivating the feature won’t remove this page or its web parts.&amp;#160; However, you can always easily implement a &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/02/16/linq-to-xml-and-deleting-files-on-feature-deactivation.aspx"&gt;feature receiver&lt;/a&gt; to cleanup the files you deployed.&amp;#160; This is how you deploy simple pages using CAML.&amp;#160; This is effectively the same way that Site Templates deploy pages as well (except the web parts and views are defined in onet.xml instead).&lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=917" width="1" height="1"&gt;</description><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Feature/default.aspx">Feature</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Deployment/default.aspx">Deployment</category></item><item><title>Speaking at SharePoint Saturday Tulsa this weekend</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/03/23/speaking-at-sharepoint-saturday-tulsa-this-weekend.aspx</link><pubDate>Mon, 23 Mar 2009 18:01:19 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:868</guid><dc:creator>CoreyRoth</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dotnetmafia.com/blogs/dotnettipoftheday/rsscomments.aspx?PostID=868</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/03/23/speaking-at-sharepoint-saturday-tulsa-this-weekend.aspx#comments</comments><description>&lt;p&gt;I am excited to see that &lt;a href="http://www.schoolofdev.com/Tulsa/2009/default.aspx"&gt;SharePoint Saturday&lt;/a&gt; is coming to Tulsa this Saturday 3/28.&amp;#160; We look to have a lot of good local speakers plus several from out of town as well.&amp;#160; I am giving my talk on deployment that I gave at &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/02/09/slides-from-my-talk-at-sharepoint-saturday-in-kansas-city.aspx"&gt;SharePoint Saturday Kansas City&lt;/a&gt;.&amp;#160; I recommend this talk for anyone starting out with SharePoint since deployment is one of the most difficult concepts to grasp.&amp;#160; &lt;/p&gt;  &lt;p&gt;For those of you that were at Tech Fest last year, you might have heard about the &lt;font color="#800080"&gt;epic&lt;/font&gt; &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/10/06/announcing-beer-and-code-meetup-after-tulsa-techfest.aspx"&gt;Beer and Code&lt;/a&gt; event brought to you by DotNetMafia.&amp;#160; Well the &lt;a href="http://www.dotnetmafia.com/blogs/kylekelin/default.aspx"&gt;godfather&lt;/a&gt; himself has declared that the DotNetMafia is doing it again for SharePoint Saturday.&amp;#160; Beer and Code will be at Dirty’s Tavern (just like last time) located at &lt;a href="http://maps.google.com/maps?f=q&amp;amp;source=s_q&amp;amp;hl=en&amp;amp;geocode=&amp;amp;q=dirty&amp;#39;s+tavern,+tulsa,+ok&amp;amp;sll=37.0625,-95.677068&amp;amp;sspn=46.543597,62.578125&amp;amp;ie=UTF8&amp;amp;z=13&amp;amp;iwloc=A"&gt;325 E 2nd St&lt;/a&gt; (2nd and Elgin – Downtown Tulsa).&amp;#160; There is even a pizza place next door now, so if I can pick up a sponsor by the end of the week, I’ll get us some to bring over to Dirty’s.&amp;#160; We’ll see you all there.&lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=868" width="1" height="1"&gt;</description><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Deployment/default.aspx">Deployment</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Presentations/default.aspx">Presentations</category></item><item><title>Slides from my talk at SharePoint Saturday in Kansas City</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/02/09/slides-from-my-talk-at-sharepoint-saturday-in-kansas-city.aspx</link><pubDate>Mon, 09 Feb 2009 15:48:00 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:838</guid><dc:creator>CoreyRoth</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dotnetmafia.com/blogs/dotnettipoftheday/rsscomments.aspx?PostID=838</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/02/09/slides-from-my-talk-at-sharepoint-saturday-in-kansas-city.aspx#comments</comments><description>&lt;p&gt;On Saturday, I had the opportunity to speak at &lt;a href="http://www.sharepointsaturday.org/default.aspx"&gt;SharePoint Saturday&lt;/a&gt; in Kansas City.&amp;nbsp;&amp;nbsp; It was a fun event with a pretty good turnout and I had the opportunity to meet lots of new people.&amp;nbsp; I gave a new talk on &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/01/05/speaking-at-sharepoint-saturday-in-kansas-city.aspx"&gt;Deploying Code in SharePoint&lt;/a&gt;.&amp;nbsp; The talk focused on walking you through building a solution package from scratch.&amp;nbsp; Slides and sample code are attached at the bottom of this post.&amp;nbsp; I was able to catch sessions from &lt;a href="http://blogs.msdn.com/mattbremer/"&gt;Matt Bremer&lt;/a&gt;, &lt;a href="http://www.dennisbottjer.com"&gt;Dennis Bottjer&lt;/a&gt; / David McCullough, and &lt;a href="http://blog.beckybertram.com/default.aspx"&gt;Becky Bertram&lt;/a&gt;.&amp;nbsp; All in all it was very informative.&amp;nbsp; The facilities at Centriq are pretty good, although the one major thing lacking is a large room to handle the welcome / prize giveaways.&amp;nbsp; I also ran into &lt;a href="http://www.davidlwalker.com/"&gt;David Walker&lt;/a&gt;, who told me that School of Dev / SharePoint Saturday Tulsa would be on 3/28 (I think).&amp;nbsp;&amp;nbsp; &lt;/p&gt; &lt;p&gt;Here is a brief list of posts that I have written about various topics relating to deployment.&lt;/p&gt;&lt;span class="Apple-style-span" style="word-spacing:0px;font:13px arial;text-transform:none;text-indent:0px;white-space:normal;letter-spacing:normal;border-collapse:separate;orphans:2;widows:2;-webkit-border-horizontal-spacing:0px;-webkit-border-vertical-spacing:0px;-webkit-text-decorations-in-effect:none;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0;"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/11/18/introduction-to-sharepoint-development-deploy-a-user-control-in-sharepoint.aspx"&gt;Introduction to SharePoint Development: Deploying a User Control in SharePoint&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/10/22/intro-to-sharepoint-development-how-to-build-and-deploy-a-web-part.aspx"&gt;Introduction to SharePoint Development: How to Build and Deploy a Web Part&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/08/21/sharepoint-to-api-translation-guide.aspx"&gt;SharePoint to API Translation Guide&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/03/05/how-to-remote-debugging-a-web-application.aspx"&gt;How to: Remote Debugging a Web Application&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2007/07/05/how-to-configure-code-access-security-for-a-web-part.aspx"&gt;How to: Configure Code Access Security for a Web Part&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/10/06/troubleshooting-cannot-import-web-part-error.aspx"&gt;Troubleshooting: Cannot Import Web Part Error&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2007/08/28/using-msbuild-to-create-a-sharepoint-wsp-file-on-build.aspx"&gt;Using MSBuild to Create a WSP file on Build&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/09/04/more-on-manfiest-xml.aspx"&gt;Deployment: More on Manifest.xml&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/07/30/how-to-build-your-own-smartpart-control.aspx"&gt;How to: Write your own SmartPart&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Thanks again to &lt;a href="http://www.mosslover.com/"&gt;Becky Isserman&lt;/a&gt; for allowing me to speak as well as heading up the whole SharePoint Saturday event.&lt;/p&gt;&lt;/span&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=838" width="1" height="1"&gt;</description><enclosure url="http://www.dotnetmafia.com/blogs/dotnettipoftheday/attachment/838.ashx" length="226669" type="application/x-zip-compressed" /><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Deployment/default.aspx">Deployment</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Presentations/default.aspx">Presentations</category></item><item><title>Introduction to SharePoint Development: Deploy a User Control in SharePoint</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/11/18/introduction-to-sharepoint-development-deploy-a-user-control-in-sharepoint.aspx</link><pubDate>Tue, 18 Nov 2008 20:07:58 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:780</guid><dc:creator>CoreyRoth</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dotnetmafia.com/blogs/dotnettipoftheday/rsscomments.aspx?PostID=780</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/11/18/introduction-to-sharepoint-development-deploy-a-user-control-in-sharepoint.aspx#comments</comments><description>&lt;p&gt;A common question I get with new SharePoint developers is &amp;quot;How do I deploy my user control in SharePoint?&amp;quot;.&amp;nbsp; Many times they know of the &lt;a href="http://www.codeplex.com/smartpart"&gt;SmartPart&lt;/a&gt; or even how to &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/07/30/how-to-build-your-own-smartpart-control.aspx"&gt;make their own&lt;/a&gt;, but its the matter of deploying things that may not be clear.&amp;nbsp; Before starting this, you need to read how to &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/10/22/intro-to-sharepoint-development-how-to-build-and-deploy-a-web-part.aspx"&gt;build and deploy a web part&lt;/a&gt;.&amp;nbsp; Many of the concepts in that article are used here and explained in more detail.&lt;/p&gt; &lt;p&gt;To build a user control, you start in very much the same way as you do with regular ASP.NET.&amp;nbsp; My recommendation is to start by creating a web application project.&amp;nbsp; You can also use a regular class library, but its easier if you use a web application project since it has the file types you need as well as references.&amp;nbsp; If you already have a class library, you can easily convert it to a web application project using a &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/02/22/how-to-hack-a-class-library-project-into-a-web-application-project.aspx"&gt;hack&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Once you have a web application project, create your user control as normal.&amp;nbsp; Build the project and then its time to deploy.&amp;nbsp; We&amp;#39;ll first talk about where the files go on the server and then we&amp;#39;ll look at how we can get the files there with a solution package.&amp;nbsp; Let&amp;#39;s assume, I have a control called MyControl.ascx.&amp;nbsp; This file has to be deployed to the SharePoint server along with its binary.&amp;nbsp; If you are using a SmartPart, the ascx file to go is in a folder called UserControls located in the root of your web sites folder (by default c:\inetpub\wwwroot\wss\VirtualDirectories\80).&amp;nbsp; However with true SharePoint development you have to break the my controls go in X folder on my site way of thinking.&amp;nbsp; In SharePoint, everything is designed to be modular no matter how many web applications your server hosts.&amp;nbsp; &lt;/p&gt; &lt;p&gt;I recommend creating your own web part to host your user control that will work with any folder.&amp;nbsp; SharePoint itself puts all user controls in the &lt;em&gt;CONTROLTEMPLATES &lt;/em&gt;folder in the 12 hive (C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12).&amp;nbsp; You can place your controls here as well, but I recommend creating a subfolder here to keep your controls separate.&amp;nbsp; In this case, I will create a folder called MyControls and copy MyControl.ascx into it.&amp;nbsp; At this point you are probably wondering what is the path to my control if its in the 12 hive?&amp;nbsp; On any SharePoint web application, there is a virtual directory called &lt;em&gt;_controltemplates&lt;/em&gt;.&amp;nbsp; This happens to map to the folder we need.&amp;nbsp; Therefore, the path you would reference in your web part (or any web page) would be &lt;em&gt;~/_controltemplates/MyControls/MyControl.ascx&lt;/em&gt;.&lt;/p&gt; &lt;p&gt;Now, it is just a matter of deploying the binary.&amp;nbsp; In traditional ASP.NET, you could just copy the DLL of your web application project to the bin folder of the web application.&amp;nbsp; However, with SharePoint we can&amp;#39;t do that without specifying &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2007/07/05/how-to-configure-code-access-security-for-a-web-part.aspx"&gt;Code Access Security&lt;/a&gt; which is a pretty big undertaking when you are starting out.&amp;nbsp; For any file that is in the bin folder, SharePoint requires a security policy be set specifying exactly what permissions your DLL has.&amp;nbsp; I recommend deploying to the bin folder, but if you are just starting out, you don&amp;#39;t want to go there yet.&amp;nbsp; To get around this for now, there are two options: 1) Change the TrustLevel in the web.config to Full or 2) Deploy the DLL to the Global Assembly Cache.&amp;nbsp; I strongly recommend against #1, so for the sake of starting out, just copy your DLL to the GAC.&amp;nbsp; You will need to strongly name your assembly.&amp;nbsp; Any time you copy the DLL to the GAC, you will need to either recycle the application pool that your web application is using or reset IIS.&amp;nbsp; I know that can be a pain, but once you implement CAS, you don&amp;#39;t have to do that any more.&lt;/p&gt; &lt;p&gt;Just like with a web part, you have to add your user control as a safe control.&amp;nbsp; Just specify the assembly name and allowed namespaces.&lt;/p&gt;&lt;span class="Apple-style-span" style="word-spacing:0px;font:13px &amp;#39;courier new&amp;#39;;text-transform:none;text-indent:0px;white-space:normal;letter-spacing:normal;border-collapse:separate;orphans:2;widows:2;-webkit-border-horizontal-spacing:0px;-webkit-border-vertical-spacing:0px;-webkit-text-decorations-in-effect:none;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;SafeControls&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span&gt;SafeControl&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:red;"&gt;Assembly&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MyControls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=03afd371f1d50a3a&lt;/span&gt;&amp;quot; &lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;span style="color:red;"&gt;Namespace&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MyControls&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:red;"&gt;TypeName&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;*&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:red;"&gt;Safe&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;True&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span&gt;SafeControls&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt; &lt;p&gt;At this point you are ready to try your new user control out.&amp;nbsp; To add it to a page like a web part, I recommend you follow the steps in this post to &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/07/30/how-to-build-your-own-smartpart-control.aspx"&gt;make your own SmartPart&lt;/a&gt;.&amp;nbsp; If you don&amp;#39;t know how to deploy a web part, follow my post on how to &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/10/22/intro-to-sharepoint-development-how-to-build-and-deploy-a-web-part.aspx"&gt;deploy a web part&lt;/a&gt;.&amp;nbsp; Once you have your smart part added, specify the path I mentioned above (&lt;em&gt;~/_controltemplates/MyControls/MyControl.ascx).&amp;nbsp; &lt;/em&gt;You can also add user controls to your master pages, just like you would in ASP.NET.&amp;nbsp; Just create the reference and add it to the .master. &lt;/p&gt; &lt;p&gt;This may sound like a lot at this point but it&amp;#39;s really not bad.&amp;nbsp; If there is enough interest in the article, I will try and get some code together in one package so people can use it as a starting point.&amp;nbsp; That is how you manually deploy a user control, we&amp;#39;ll move onto how we do it with a solution package.&lt;/p&gt; &lt;h5&gt;Deploying via Solution Package&lt;/h5&gt; &lt;p&gt;For deployment, we will pretty much follow what we did in the deployment of the web part.&amp;nbsp; For more details on building solution packages, please see that &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/10/22/intro-to-sharepoint-development-how-to-build-and-deploy-a-web-part.aspx"&gt;post&lt;/a&gt;.&amp;nbsp; In this case a feature is not necessary unless you want to automate the deployment of the &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/09/15/using-caml-to-add-web-parts-to-an-existing-page.aspx"&gt;user controls onto an existing page&lt;/a&gt;.&amp;nbsp; The cab.ddf file only contains lines to copy the binary and .ascx file.&lt;/p&gt;&lt;pre&gt;; ** MyControls.wsp  **
.OPTION EXPLICIT     ; Generate errors 
.Set CabinetNameTemplate=MyControls.wsp     
.set DiskDirectoryTemplate=CDROM ; All cabinets go in a single directory
.Set CompressionType=MSZIP;** All files are compressed in cabinet files
.Set UniqueFiles=&amp;quot;ON&amp;quot;
.Set Cabinet=on
.Set DiskDirectory1=Package

Solution\manifest.xml manifest.xml

;binaries
bin\MyControls.dll MyControls.dll

;feature files

;template files
MyControl.ascx CONTROLTEMPLATES\MyControls\MyControl.ascx
&lt;/pre&gt;
&lt;p&gt;The Manfiest.xml file will contain entries to copy your ascx file out as well as copy your binary to the GAC.&amp;nbsp; It will also add the Safe Control entry that you need.&amp;nbsp; Here is what the file would look like.&amp;nbsp; The &lt;em&gt;TemplateFile&lt;/em&gt; element is used to specify every .ascx file that you want copied to the server.&amp;nbsp; More details on what you can do with the manifest file are &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/09/04/more-on-manfiest-xml.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Solution&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;SolutionId&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;{FA34A0BE-FEAA-4750-9E82-B313F62C5CF9}&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:red;"&gt;xmlns&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;http://schemas.microsoft.com/sharepoint/&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;ResetWebServer&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;true&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TemplateFiles&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TemplateFile&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Location&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;CONTROLTEMPLATES\MyControls\MyControl.ascx&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TemplateFiles&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Assemblies&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Assembly&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;DeploymentTarget&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;GlobalAssemblyCache&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Location&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MyControls.dll&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SafeControls&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SafeControl&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Assembly&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MyControls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=03afd371f1d50a3a&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Namespace&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MyControls&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;TypeName&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;*&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Safe&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;True&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SafeControls&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Assembly&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Assemblies&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Solution&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;At this point, you build and deploy the .wsp file as described in &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/10/22/intro-to-sharepoint-development-how-to-build-and-deploy-a-web-part.aspx"&gt;my web part post&lt;/a&gt;.&amp;nbsp; Again, I strongly recommend reading that post if you are not familiar with any of the deployment steps yet.&amp;nbsp; The nice thing about having your user control in a solution package is that it is now completely portable.&amp;nbsp; It can be deployed to your other SharePoint servers very easily.&amp;nbsp; Once you have mastered the process, I recommend you start deploying your binaries to the bin folder with &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2007/07/05/how-to-configure-code-access-security-for-a-web-part.aspx"&gt;Code Access Security&lt;/a&gt;.&amp;nbsp; Once you have the solution package built, adding CAS is pretty easy and it saves you from having to kill your app pool every time you do a deployment.&lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=780" width="1" height="1"&gt;</description><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Deployment/default.aspx">Deployment</category></item><item><title>Intro to SharePoint Development: How to Build and Deploy a Web Part</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/10/22/intro-to-sharepoint-development-how-to-build-and-deploy-a-web-part.aspx</link><pubDate>Wed, 22 Oct 2008 12:50:00 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:751</guid><dc:creator>CoreyRoth</dc:creator><slash:comments>31</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dotnetmafia.com/blogs/dotnettipoftheday/rsscomments.aspx?PostID=751</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/10/22/intro-to-sharepoint-development-how-to-build-and-deploy-a-web-part.aspx#comments</comments><description>&lt;p&gt;UPDATE: &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2010/02/15/intro-to-sharepoint-2010-development-how-to-build-and-deploy-a-web-part.aspx"&gt;Building Web Parts in SharePoint 2010&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve recently helped out a number of developers new to SharePoint and I found that I have been often asked the same types of questions.&amp;nbsp; Most of those involve getting started and deployment, so today, I am beginning my series on getting started with SharePoint.&amp;nbsp; Most new developers find starting out pretty overwhelming, but once you get used to it, it does all make sense.&amp;nbsp; Hopefully this post will help the community and keep new SharePoint developers from getting scared off.&amp;nbsp; There have been a lot of posts on this topic I admit.&amp;nbsp; Since there are so many ways to do things, I wanted to write this post as a reference to new developers so they can see how I usually do things.&amp;nbsp; What I find is that most developers have no trouble getting a web part built, but when it comes time to deploy it, they are lost.&amp;nbsp; There are multiple ways to do this and not all of them are necessarily the right way.&lt;/p&gt; &lt;h4&gt;Environment&lt;/h4&gt; &lt;p&gt;Let&amp;#39;s start by talking about your development environment.&amp;nbsp; In an ideal situation, you probably have your own virtual machine with Windows Server 2008 (or 2003), MOSS 2007, and Visual Studio 2008 installed.&amp;nbsp; However, maybe you don&amp;#39;t have your own dedicated machine and you are going to be developing on a Windows XP machine, but deploying to a remote SharePoint server.&amp;nbsp; This is fine, but you are going to have to do some things a little differently.&amp;nbsp; First, you won&amp;#39;t be able to install the &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/06/04/wss-3-0-tools-visual-studio-extensions-1-2-running-under-windows-vista.aspx"&gt;Visual Studio Extensions for SharePoint&lt;/a&gt;.&amp;nbsp; You can live without this though because most people I have ran into say they don&amp;#39;t use them.&amp;nbsp; Secondly, when it comes to deployment (which we&amp;#39;ll talk about down below), you are going to have to copy your source files (either manually or via solution package) to the server.&amp;nbsp; You are also going to have to &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/03/05/how-to-remote-debugging-a-web-application.aspx"&gt;remote debug&lt;/a&gt; but fret not my post on it makes it easy.&lt;/p&gt; &lt;p&gt;If you are developing on a desktop, another thing you will need to do is copy the SharePoint assemblies to your computer.&amp;nbsp; We can easily get these from a deployed SharePoint server.&amp;nbsp; However, this is a great time to take an aside and talk about some of the SharePoint directory structure.&lt;/p&gt; &lt;p&gt;&lt;em&gt;C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12&lt;/em&gt;&lt;/p&gt; &lt;p&gt;All SharePoint developers have that file path permanently burned into their memory.&amp;nbsp; It is often referred to as the 12 hive.&amp;nbsp; A lot of things happen within this folder.&amp;nbsp; Subfolders here contain the SharePoint binaries, Master Pages, Application Pages, User Controls, Configuration Files, and Features.&amp;nbsp;&amp;nbsp; Although SharePoint will let you customize any file in here, in general you don&amp;#39;t want to make changes to any of these builtin files as it puts you in an unsupported scenario.&amp;nbsp; If you want to customize a master page or a style, it is typically best that you make a copy of what you want to customize and go from there.&amp;nbsp; Here is a quick list of some of the key folders and what they are used for.&lt;/p&gt; &lt;table cellspacing="0" cellpadding="2"&gt;  &lt;tr&gt; &lt;td&gt;&lt;strong&gt;Folder&lt;/strong&gt;&lt;/td&gt; &lt;td&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;CONFIG&lt;/td&gt; &lt;td&gt;Contains &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2007/07/05/how-to-configure-code-access-security-for-a-web-part.aspx"&gt;partial trust&lt;/a&gt; configuration files&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;ISAPI&lt;/td&gt; &lt;td&gt;Binaries and SharePoint Web Services&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;LOGS&lt;/td&gt; &lt;td&gt;Error Logs (look here first when you get a strange error)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;TEMPLATE\CONTROLTEMPLATES&lt;/td&gt; &lt;td&gt;User Controls&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;TEMPLATE\FEATURES&lt;/td&gt; &lt;td&gt;SharePoint Features (turns functionality on and off)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;TEMPLATE\IMAGES&lt;/td&gt; &lt;td&gt;MainImages Folder&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;TEMPLATE\LAYOUTS&lt;/td&gt; &lt;td&gt;Pages and Styles&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;TEMPLATE\SiteTemplates&lt;/td&gt; &lt;td&gt;Definitions avaiable for deploying new sites&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;TEMPLATE\THEMES&lt;/td&gt; &lt;td&gt;Used to create custom themes in SharePoint&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;TEMPLATE\XML&lt;/td&gt; &lt;td&gt;Contains XSDs for any XML used with SharePoint&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; &lt;p&gt;Enough on that tangent, back to the assemblies that we need to copy.&amp;nbsp; Go to the above path and then go into the ISAPI folder.&amp;nbsp; Copy all of the DLLs from this folder onto your desktop machine in the corresponding folder name.&amp;nbsp; If you don&amp;#39;t have that folder, create it.&amp;nbsp; You may also copy them to the Global Assembly Cache as well.&amp;nbsp; Once you are this point, you are ready to being building a web part.&lt;/p&gt; &lt;h4&gt;Coding the Web Part&lt;/h4&gt; &lt;p&gt;Start by creating a new class library project in Visual Studio.&amp;nbsp; There are packages and tools out there to automate some of these steps, but its best that you learn how to do it first by hand, so you know how to troubleshoot it should something go wrong.&amp;nbsp; Next, you will want to add (at a minimum) a reference to Microsoft.SharePoint.dll.&amp;nbsp; You can either grab it out of the GAC (will be listed under Windows SharePoint Services) or use the copy that you put in your ISAPI folder.&amp;nbsp; After you add it, make sure &lt;em&gt;Copy Local&lt;/em&gt; is set to false on your reference.&amp;nbsp; You will also want to add System.Web since more than likely your web part will use an ASP.NET control in it.&amp;nbsp; You are now ready to create your web part.&amp;nbsp; To do this, create a new class and add a using statement for &lt;em&gt;Microsoft.SharePoint&lt;/em&gt;.&amp;nbsp; In the past, you would derive your class from &lt;em&gt;Microsoft.SharePoint.WebPart&lt;/em&gt; (and you still can), but now the more accepted way of doing things is to derive from the new &lt;em&gt;System.Web.UI.WebParts.WebPart&lt;/em&gt; class.&amp;nbsp; The latter comes from ASP.NET 2.0 and can actually be deployed outside of SharePoint.&amp;nbsp; Here is what our class is going to look like.&lt;/p&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;TestWebPart&lt;/span&gt; : System.Web.UI.WebControls.WebParts.&lt;span style="color:#2b91af;"&gt;WebPart&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;{&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;protected&lt;/span&gt; &lt;span style="color:blue;"&gt;override&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; CreateChildControls()&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;base&lt;/span&gt;.CreateChildControls();&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Controls.Add(&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Label&lt;/span&gt;(){Text = &lt;span style="color:#a31515;"&gt;&amp;quot;My Test Web Part (Hello World)!&amp;quot;&lt;/span&gt;});&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin:0px;"&gt;}&lt;/p&gt;&lt;/div&gt; &lt;p&gt;The content of the class is simple.&amp;nbsp; We use the overridden &lt;em&gt;CreateChildControls&lt;/em&gt; method to add ASP.NET controls to the page to do the rendering.&amp;nbsp; I simply call Control.Add and add a Label control with the text above.&amp;nbsp; Compile it and this web part is good to go, but there is the small matter of deploying it.&amp;nbsp; Compiling it yield you a DLL that has be deployed to SharePoint somehow.&amp;nbsp; SharePoint also needs to know where the web part is and how to reference it.&amp;nbsp; This is where the .webpart file comes in.&lt;/p&gt; &lt;h4&gt;Describing the WebPart&lt;/h4&gt; &lt;p&gt;The .webpart file is an XML file that tells SharePoint what to call your DLL and what assembly it is located in.&amp;nbsp; The easiest way to get started creating this file is to copy another one in SharePoint.&amp;nbsp; You can find plenty of examples by going to your web part gallery (Site Root -&amp;gt; Site Settings -&amp;gt; Web Parts).&amp;nbsp; this file simply describes the class and assembly of your web part as well as some default properties (i.e.: it sets a title and description).&amp;nbsp; You can also add your own properties by specifying a series of attributes on a property in your class.&lt;/p&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;webParts&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;webPart&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;xmlns&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;http://schemas.microsoft.com/WebPart/v3&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;metaData&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;type&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MyWebPart.TestWebPart, MyWebPart, Version=1.0.0.0, Culture=neutral&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;importErrorMessage&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Cannot import this Web Part.&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;importErrorMessage&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;metaData&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;data&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;properties&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;property&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;Title&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;type&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;string&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;My Web Part&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;property&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;property&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;Description&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;type&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;string&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;A test web part.&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;property&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;properties&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;data&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;webPart&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p&gt;Note: There is also a &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/08/21/the-difference-between-dwp-and-webpart.aspx"&gt;.dwp&lt;/a&gt; file, which comes from version 2, that can describe your webpart as well.&amp;nbsp; It still works but it is consider deprecated.&lt;/p&gt; &lt;h4&gt;Ghetto Deploying&lt;/h4&gt; &lt;p&gt;So far, we have built a web part and created a .webpart file so now it is time to deploy it.&amp;nbsp; We&amp;#39;ll start by doing it the &lt;em&gt;wrong&lt;/em&gt; way.&amp;nbsp; The first thing to know is that you can&amp;#39;t just copy your DLL into the bin folder of your web application unless you change to full trust (not recommended) or specify &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2007/07/05/how-to-configure-code-access-security-for-a-web-part.aspx"&gt;Code Access Security&lt;/a&gt;.&amp;nbsp; Specifying CAS when first starting out will make even the most seasoned developers run for the hills.&amp;nbsp; So we are going to start by deploying to the GAC.&amp;nbsp; In almost all situations, I recommend against this, but for the sake of getting you started, it is ok.&amp;nbsp; You can then follow the Code Access Security post later on how to set up everything properly.&lt;/p&gt; &lt;p&gt;Start by copying your compiled DLL into the Global Assembly Cache of your SharePoint server.&amp;nbsp; Keep in mind anytime you update this DLL, you will need to either reset IIS or recycle the application pool (otherwise the old version stays in memory).&amp;nbsp; The next thing you need to do is upload the .webpart file to the web part gallery of your site collection (again Site Root -&amp;gt; Site Settings -&amp;gt; Web Parts).&amp;nbsp; At this point, SharePoint will be able to recognize your web part and it can be added to a page.&amp;nbsp; If you click on the name of the web part in the gallery (in this case MyWebPart.webpart), it will display a preview of what it will look like on a page.&amp;nbsp; If everything is working correctly, you will see your web part, otherwise you will get an error.&amp;nbsp; At this point, you will have the following error.&lt;/p&gt; &lt;p&gt;&lt;span class="Apple-style-span" style="word-spacing:0px;font:13px verdana;text-transform:none;text-indent:0px;white-space:normal;letter-spacing:normal;border-collapse:separate;orphans:2;widows:2;-webkit-border-horizontal-spacing:0px;-webkit-border-vertical-spacing:0px;-webkit-text-decorations-in-effect:none;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0;"&gt;&lt;em&gt;A web part on this web part page cannot be displayed or imported because it is not registered on this site as safe.&lt;/em&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;This is because there is one more step to do.&amp;nbsp; Every web part or user control in SharePoint must be registered as safe to execute in the web.config.&amp;nbsp; To do this, find the &lt;em&gt;SafeControls&lt;/em&gt; element near the top and add the following line (changing it with your fully qualified assembly path).&lt;/p&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SafeControls&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SafeControl&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Assembly&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MyWebPart, Version=1.0.0.0, Culture=neutral&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Namespace&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MyWebPart&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;TypeName&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;*&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Safe&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;True&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SafeControls&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p&gt;Now when you go back to the web part gallery, it should give you a preview of your web part.&amp;nbsp; If it doesn&amp;#39;t check your assembly paths and make sure the file is deployed.&amp;nbsp; If you still have issues, check out this post on &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/10/06/troubleshooting-cannot-import-web-part-error.aspx"&gt;troubleshooting a web part&lt;/a&gt;.&amp;nbsp; Assuming you were able to get the web part to preview, you can also go add it to a page by going to any page, clicking Edit Page and then Add Web Part.&amp;nbsp; Scroll through the list until you find your web part and select it.&amp;nbsp; You should then see your web part on the page.&lt;/p&gt; &lt;h4&gt;Features&lt;/h4&gt; &lt;p&gt;So we talked about deploying a web part the wrong way.&amp;nbsp; Ok, it&amp;#39;s not necessarily wrong, but it really adds a lot of extra work&amp;nbsp; This can be automated quite a bit by using features and solution packages.&amp;nbsp; Creating a feature, allows you to turn on and off customizations to SharePoint at the click of a button.&amp;nbsp; They can be used to deploy web parts, site definitions, workflows, document libraries, and plenty of other things.&amp;nbsp; In this case, we are building a feature to automate the deployment of our .webpart file.&amp;nbsp; You can also specify a class (Feature Receiver) that is executed when the feature is installed, activated, deactivated, or uninstalled.&amp;nbsp; A feature typically consists of two XML files.&amp;nbsp; The first file Feature.xml (must be named that), describes the feature and where its feature receiver is (if any).&amp;nbsp; &lt;/p&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Feature&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:red;"&gt;xmlns&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;http://schemas.microsoft.com/sharepoint/&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:red;"&gt;Id&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;{BDD425C3-CA50-4aee-9170-73954044D764}&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:red;"&gt;Scope&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;Site&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:red;"&gt;Hidden&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;False&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:red;"&gt;Title&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;My Web Part&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:red;"&gt;Description&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;My Test Web Part&lt;/span&gt;&amp;quot;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ElementManifests&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ElementManifest&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Location&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;Elements.xml&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ElementManifests&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Feature&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p&gt;The &lt;em&gt;Id&lt;/em&gt; element contains a GUID.&amp;nbsp; Every feature needs a different one.&amp;nbsp; The &lt;em&gt;Scope &lt;/em&gt;attribute specifies where to deploy the feature.&amp;nbsp; Possible values are &lt;em&gt;Site, Web, WebApplication, &lt;/em&gt;and &lt;em&gt;Farm&lt;/em&gt;.&amp;nbsp; I would go into the difference in scopes, because this post is already getting long enough.&amp;nbsp; You will most likely use Site or Web for most things you do (&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/08/21/sharepoint-to-api-translation-guide.aspx"&gt;note on terms in API&lt;/a&gt;).&amp;nbsp; The &lt;em&gt;ElementManifest &lt;/em&gt;element makes calls to additional XML files.&amp;nbsp; Typically the other file is called Elements.xml (although it can be called anything).&lt;/p&gt; &lt;p&gt;The Elements.xml file can be used to deploy files, create document libraries, and many other functions.&amp;nbsp; I won&amp;#39;t go into the whole detail of this file (it&amp;#39;s in the SDK), but basically we are specifying that the &lt;em&gt;MyWebPart.webpart&lt;/em&gt; file should be copied into the web part gallery.&amp;nbsp; I will tell you what a few things are though.&amp;nbsp; In this case the Module element says that we are going to deploy something into a list that is located at &lt;em&gt;_catalogs/wp &lt;/em&gt;(this is the URL of the web part gallery).&amp;nbsp; How did I figure this out?&amp;nbsp; I looked at another example.&amp;nbsp; The File element deploys our MyWebPart.webpart file into the web part gallery.&amp;nbsp; I wont go into why you set the Type to &lt;em&gt;GhostableInLibrary&lt;/em&gt; right now.&amp;nbsp; Just know this is the value you will pretty much always use.&lt;/p&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Elements&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;xmlns&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;http://schemas.microsoft.com/sharepoint/&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Module&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;WebPartPopulation&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;List&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;113&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Url&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;_catalogs/wp&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;RootWebOnly&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;TRUE&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;File&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Url&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MyWebPart.webpart&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Type&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;GhostableInLibrary&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Module&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Elements&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p&gt;When the feature is activated, it will put the file in the web part gallery.&amp;nbsp; However, it won&amp;#39;t &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/03/04/reminder-delete-web-parts-from-gallery-when-changing-version-numbers.aspx"&gt;remove the item&lt;/a&gt; from the web part gallery on deactivation.&amp;nbsp; It&amp;#39;s pretty easy to do with code and I still plan to write a post on it.&amp;nbsp; For now, if you want the .webpart file gone you will have to delete it manually.&amp;nbsp; During the development cycle though, the only time it really is necessary to remove a .webpart file is if you have changed the namespace, class name, or public key token.&amp;nbsp; Here is what an elements file typically looks like for deploying a web part.&lt;/p&gt; &lt;p&gt;So where do all these files go?&amp;nbsp; Let&amp;#39;s talk about where you put them in your Visual Studio project first.&amp;nbsp; Typically, what you will do is create a folder structure in your project that matches the 12 hive.&amp;nbsp; So in this case, we will create a TEMPLATE\FEATURES folder.&amp;nbsp; We will then create a folder for our web part.&amp;nbsp; I am just calling it MyWebPart for now.&amp;nbsp; Here is what your solution will look like.&amp;nbsp; This folder is where you will put Feature.xml, Elements.xml, and MyWebPart.webpart.&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/WindowsLiveWriter/BacktoBasicsHowtoBuildandDeployaWebPart_E55A/image_2.png"&gt;&lt;img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="244" alt="image" src="http://www.dotnetmafia.com/blogs/dotnettipoftheday/WindowsLiveWriter/BacktoBasicsHowtoBuildandDeployaWebPart_E55A/image_thumb.png" width="238" border="0" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;To deploy the feature, copy it to the TEMPLATE\FEATURES folder in your 12 hive.&amp;nbsp; You then need to use stsadm command to install it.&amp;nbsp; The stsadm executable is located in the bin folder of the 12 hive.&amp;nbsp; You tend to use it a lot, so you might want to put it in your path environment variable.&amp;nbsp; Once you have located it, issue the following command.&lt;/p&gt; &lt;p&gt;&lt;em&gt;stsadm -o installfeature -name MyWebPart&lt;/em&gt;&lt;/p&gt; &lt;p&gt;This makes the feature available to be activated.&amp;nbsp;&amp;nbsp; To activate it, go to Site Collection Features (Site Root -&amp;gt; Site Settings -&amp;gt; Site Collection Features).&amp;nbsp; Find the feature in the list and click the Activate button.&amp;nbsp; This deploys the web part to the gallery and it can be added to pages as before.&amp;nbsp; If you ever want to remove the feature, use the &lt;em&gt;uninstallfeature&lt;/em&gt; operation.&amp;nbsp; You will want to deactivate the feature first, otherwise you will have to use the -force parameter when using stsadm.&lt;/p&gt; &lt;h4&gt;Deploying Via Solution Package&lt;/h4&gt; &lt;p&gt;Features are nice, but we can take this one step further.&amp;nbsp; A solution package (.wsp file) allows you to package your entire solution into one .wsp file for deployment.&amp;nbsp; A .wsp file is simply a cab file with a manifest.xml file that tells SharePoint how to install the contents.&amp;nbsp; It will even deploy and install your feature for you, allowing you to skip the installation steps above.&amp;nbsp; Two files are required to build the .wsp file: cab.ddf and manifest.xml.&amp;nbsp; These files typically go into a folder called Solution in your Visual Studio project.&amp;nbsp; Cab.ddf tells the utility, makecab.exe, how to construct the .wsp file.&amp;nbsp;&amp;nbsp; Below is an example DDF file.&amp;nbsp; You will need to set the &lt;em&gt;CabinetNameTemplate&lt;/em&gt; to the filename you want for your wsp file.&amp;nbsp; You then specify a source and destination for each file you want copied.&amp;nbsp; In the example below, note that I am copying the DLL, Elements.xml, Feature.xml, and MyWebPart.webpart file.&amp;nbsp; &lt;/p&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt;; ** MyWebPart.wsp **&lt;/p&gt; &lt;p style="margin:0px;"&gt;.OPTION EXPLICIT&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Generate errors &lt;/p&gt; &lt;p style="margin:0px;"&gt;.Set CabinetNameTemplate=MyWebPart.wsp&lt;/p&gt; &lt;p style="margin:0px;"&gt;.set DiskDirectoryTemplate=CDROM ; All cabinets go in a single directory&lt;/p&gt; &lt;p style="margin:0px;"&gt;.Set CompressionType=MSZIP;** All files are compressed in cabinet files&lt;/p&gt; &lt;p style="margin:0px;"&gt;.Set UniqueFiles=&amp;quot;ON&amp;quot;&lt;/p&gt; &lt;p style="margin:0px;"&gt;.Set Cabinet=on&lt;/p&gt; &lt;p style="margin:0px;"&gt;.Set DiskDirectory1=Package&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;Solution\manifest.xml manifest.xml&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;; binary&lt;/p&gt; &lt;p style="margin:0px;"&gt;bin\debug\MyWebPart.dll MyWebPart.dll&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;; feature files&lt;/p&gt; &lt;p style="margin:0px;"&gt;TEMPLATE\FEATURES\MyWebPart\Elements.xml MyWebPart\Elements.xml&lt;/p&gt; &lt;p style="margin:0px;"&gt;TEMPLATE\FEATURES\MyWebPart\Feature.xml MyWebPart\Feature.xml&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;; web part files&lt;/p&gt; &lt;p style="margin:0px;"&gt;TEMPLATE\FEATURES\MyWebPart\MyWebPart.webpart FEATURES\MyWebPart\MyWebPart.webpart&lt;/p&gt;&lt;/div&gt; &lt;p&gt;I won&amp;#39;t go into manifest.xml again because I have already covered it once in this &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/09/04/more-on-manfiest-xml.aspx"&gt;post&lt;/a&gt;.&amp;nbsp; It&amp;#39;s this file that tells SharePoint how to deploy features, copy files, setup code access security, and add SafeControl entries to your web.config.&amp;nbsp; Once you create your solution files, build your project and then go to the command line.&amp;nbsp; The utility makecab.exe (should already be on your system) will actually create the wsp file.&amp;nbsp; In the command prompt, go to the root folder of your project and execute the following command.&amp;nbsp; It has to be executed from that folder because all of the paths are relative.&lt;/p&gt; &lt;p&gt;&lt;em&gt;makecab.exe /f solution\cab.ddf&lt;/em&gt;&lt;/p&gt; &lt;p&gt;You can automate this step when you build, by creating a &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2007/08/28/using-msbuild-to-create-a-sharepoint-wsp-file-on-build.aspx"&gt;build action&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;If you are working on a remote server, you will need to copy the .wsp file onto the server. Add and deploy the solution with the following commands.&lt;/p&gt;&lt;pre&gt;stsadm -o addsolution -filename package\MyAssembly.wsp
stsadm -o deploysolution -name MyAssembly.wsp -immediate -allContentUrls -allowGacDeployment
stsadm -o execadmsvcjobs&lt;/pre&gt;
&lt;p&gt;At this point if all goes well, your solution will be installed and deployed.&amp;nbsp; This eliminates all the steps of manually copying files into SharePoint.&amp;nbsp; You can then activate your feature like before (remember it installs the feature for you) and add your web part to a page.&amp;nbsp; If you make an update to your web part, deploying is easy, just use the &lt;em&gt;upgradesolution&lt;/em&gt; stsadm command and it will update all the files in your solution.&amp;nbsp; Should you decide, you don&amp;#39;t need the solution any more, use the &lt;em&gt;retractsolution&lt;/em&gt; command.&amp;nbsp; After you issue either of those commands, you will need to follow it up with a &lt;em&gt;execadmsvcjobs&lt;/em&gt; command as shown above.&lt;/p&gt;
&lt;p&gt;This may sound like a lot, but it really isn&amp;#39;t bad.&amp;nbsp; It makes deployment really easy (especially to other servers).&amp;nbsp; Once you have your solution deployed and you want to make an update, you can also just directly copy out the binary to your server.&amp;nbsp; Not really a best practice, but it does speed things up quite a bit, since stsadm commands take a few seconds to run.&lt;/p&gt;
&lt;p&gt;Once you get the hang of it and are familiar with the deployment process, you really need to consider deploying your solution to the bin folder by deploying your solution under partial trust.&amp;nbsp; Remember right now, you are deploying to the GAC which is not ideal.&amp;nbsp; My post on &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2007/07/05/how-to-configure-code-access-security-for-a-web-part.aspx"&gt;Code Access Security&lt;/a&gt; walks you through the whole process and provides more details on how solution packages are built.&lt;/p&gt;
&lt;h4&gt;User Controls&lt;/h4&gt;
&lt;p&gt;By now, you may be thinking, I went through all of that and I still have to render stuff to the screen using straight code?&amp;nbsp; I hear you.&amp;nbsp; It&amp;#39;s not any fun at all and can be a &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/08/04/to-web-part-or-not-to-web-part.aspx"&gt;controversy&lt;/a&gt; among some SharePoint developers.&amp;nbsp; You do have a couple of alternatives, use the &lt;a href="http://www.codeplex.com/smartpart"&gt;SmartPart&lt;/a&gt; or &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/07/30/how-to-build-your-own-smartpart-control.aspx"&gt;write your own&lt;/a&gt;.&amp;nbsp; I typically go with the latter.&amp;nbsp; This simple web part uses Page.LoadControl to load the .ascx file you specify. &lt;/p&gt;
&lt;p&gt;This is quickly becoming the longest post I have ever written.&amp;nbsp; I&amp;#39;ve attached the code I used in this post.&amp;nbsp; You can use it to verify that you put your own web part together correctly or you can use it as a starting point.&amp;nbsp; I hope this provides enough information for a new SharePoint developer to get started.&amp;nbsp; I certainly wish I had this much info condensed in one place when I was starting out.&amp;nbsp; You may also want to check out one of the many solution generating tools out there such as &lt;a href="http://www.codeplex.com/stsdev"&gt;stsdev&lt;/a&gt;.&amp;nbsp; Please leave a comment if this helps or if you have any questions.&amp;nbsp; If I am missing anything or you think I need to add anything, also please let me know.&lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=751" width="1" height="1"&gt;</description><enclosure url="http://www.dotnetmafia.com/blogs/dotnettipoftheday/attachment/751.ashx" length="25753" type="application/x-zip-compressed" /><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Feature/default.aspx">Feature</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Code+Access+Security/default.aspx">Code Access Security</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/WebPart/default.aspx">WebPart</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Deployment/default.aspx">Deployment</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Solution/default.aspx">Solution</category></item><item><title>Troubleshooting: Cannot import Web Part Error</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/10/06/troubleshooting-cannot-import-web-part-error.aspx</link><pubDate>Mon, 06 Oct 2008 22:20:54 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:726</guid><dc:creator>CoreyRoth</dc:creator><slash:comments>18</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dotnetmafia.com/blogs/dotnettipoftheday/rsscomments.aspx?PostID=726</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/10/06/troubleshooting-cannot-import-web-part-error.aspx#comments</comments><description>&lt;p&gt;Let&amp;#39;s face it, any new SharePoint developer is going to run into an error such as the one below when starting out.&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="color:#1f497d;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;em&gt;[WebPartPageUserException: Cannot import MyWebPart Web Part.]&lt;/em&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="color:#1f497d;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;em&gt;&amp;nbsp; at Microsoft.SharePoint.WebPartPages.WebPartImporter.CreateWebPart(Boolean clearConnections) &lt;/em&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="color:#1f497d;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;em&gt;&amp;nbsp; at Microsoft.SharePoint.WebPartPages.WebPartImporter.Import(SPWebPartManager manager, XmlReader reader, Boolean clearConnections, Uri webPartPageUri, SPWeb spWeb) &lt;/em&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="color:#1f497d;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;em&gt;&amp;nbsp; at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CompressWebPartNoSave(Boolean isClosed)&lt;/em&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt; &lt;p&gt;I&amp;#39;ve found myself doing a LOT of troubleshooting of this for developers, so I decided it was time to post the steps in helping me resolve this issue.&amp;nbsp; This issue can be a number of things, but the first place I always check is the web part gallery.&amp;nbsp; If you can&amp;#39;t view your web part in the gallery, chances are it&amp;#39;s not going to work.&amp;nbsp; The first thing you need to do is verify that your web part is in fact in the list.&amp;nbsp; If it&amp;#39;s not, you need to go install it (either manually or via solution package / feature).&amp;nbsp; If it is there, click on the link to the web part (i.e. MyWebPart.webpart), not the icon.&amp;nbsp; If you get an error like the one above, you definitely know something is wrong with the way the web part is installed on your server.&lt;/p&gt; &lt;p&gt;The next thing you do is click the Edit icon (the one next to the webpart link).&amp;nbsp; From this page, you can make use of the View XML link to look at the .webpart file that is installed.&amp;nbsp; More than likely at this point, the assembly path is wrong to your DLL or the DLL is not installed on your system.&amp;nbsp; Confirm that the assembly path is correct given your DLL.&amp;nbsp; For example, if your DLL is strongly signed, make sure the public key token is listed on the assembly path.&amp;nbsp; If the DLL is not in the GAC, I recommend leaving off the PublicKeyToken becuase it will try and find that DLL in the global assembly cache which will give you an error saying that it cannot find the DLL.&amp;nbsp; Other issues I have ran into here is the version number.&amp;nbsp; Sometimes specify the version number as 1.0.* (for example).&amp;nbsp; This usually works but I have seen issues where it would not work unless you specified 1.0.0.0.&amp;nbsp; I am sure there is a reason for that, but I have no idea what it is.&amp;nbsp; Also remember, if you change your assembly path ever (i.e.: you change the PublicKeyToken or namespace) and redeploy, you need to delete the .webpart file out of the gallery.&amp;nbsp; You can do this manually or write code to do it with a feature receiver.&lt;/p&gt; &lt;p&gt;If you have verified that your .webpart is correct, make sure that the DLL for you web part actually exists.&amp;nbsp; I know this sounds obvious, but lots of things can cause a solution package to install silently which means your DLL may not be present in the bin folder or the GAC when you think it should be.&amp;nbsp; Also remember that you probably need to reset IIS (or at least the application pool), if you have deployed a DLL to the GAC for SharePoint to pick it up.&lt;/p&gt; &lt;p&gt;Of course, make sure you have a SafeControls entry in the web.config file for your assembly.&amp;nbsp; Although, this would probably result in a Cannot register this type as safe error.&amp;nbsp; This error can often times be quite frustrating because it will seem as if you have done all the steps to make sure it works and it just doesn&amp;#39;t.&amp;nbsp; Don&amp;#39;t forget to check the logs (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\logs) too.&amp;nbsp; This error will show up in there and there may be extra information in there to help you find your error.&amp;nbsp; Just keep at it and double check everything and usually you can find something.&lt;/p&gt;&lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=726" width="1" height="1"&gt;</description><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Feature/default.aspx">Feature</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/WebPart/default.aspx">WebPart</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Deployment/default.aspx">Deployment</category></item><item><title>More on Manfiest.xml</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/09/04/more-on-manfiest-xml.aspx</link><pubDate>Thu, 04 Sep 2008 15:19:32 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:678</guid><dc:creator>CoreyRoth</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dotnetmafia.com/blogs/dotnettipoftheday/rsscomments.aspx?PostID=678</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/09/04/more-on-manfiest-xml.aspx#comments</comments><description>&lt;p&gt;There are a ton of tools out there to create SharePoint solution packages (.wsp files) for you, but it is still a good idea to know what those tools are creating for you exactly.&amp;nbsp; Sometimes, things don&amp;#39;t always work right, and you may need to customize or tweak your manifest file.&amp;nbsp; If you are new to SharePoint development, the Manifest.xml file is used during the deployment of a .wsp solution package.&amp;nbsp; It tells SharePoint what files to copy, what features to install, where to put your binaries, adds &lt;em&gt;SafeControl&lt;/em&gt; entries, as well as set code access security.&amp;nbsp; The file seems pretty straight forward but there are a lot of ways to mess it up.&amp;nbsp; As I pointed out in the past, do not put any &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2007/07/05/avoid-comments-in-a-sharepoint-deployment-manifest.aspx"&gt;comments&lt;/a&gt; in this file.&amp;nbsp; It will cause all kinds of FAIL.&amp;nbsp; &lt;/p&gt; &lt;p&gt;I&amp;#39;ll start by go over the key elements of this file and point out some things you need to know about each one.&amp;nbsp; If you create any of these main elements, note, that they will always require some kind of child element, otherwise the file won&amp;#39;t validate.&amp;nbsp; The first element we will talk about is &lt;em&gt;FeatureManifests&lt;/em&gt;.&amp;nbsp; This name as it sounds is used to deploy features.&amp;nbsp; Your solution will install features but not activate them for you.&amp;nbsp; You can list multiple features to install here using the &lt;em&gt;FeatureManifest &lt;/em&gt;element.&amp;nbsp; It&amp;#39;s &lt;em&gt;Location&lt;/em&gt; attribute specifies the path to the feature (inside the DDF file).&amp;nbsp; What that means is the path specified to your feature.xml file will match whatever you have listed as the destination in your DDF file.&amp;nbsp; We can talk about DDF files again another day if necessary.&lt;/p&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;FeatureManifests&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;FeatureManifest&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Location&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MyFeature\feature.xml&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;FeatureManifests&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p&gt;The &lt;em&gt;TemplateFiles&lt;/em&gt; element is used to copy out any additional files to the SharePoint server.&amp;nbsp; These could be .webpart files, user controls, other XML files, application pages, master pages, etc.&amp;nbsp; SharePoint will not copy any file that is not listed here (except for binaries and feature.xml and related files).&amp;nbsp; Again, you can specify multiple &lt;em&gt;TemplateFile&lt;/em&gt; child elements to copy multiple files.&amp;nbsp; Part of what makes this file tricky is the paths.&amp;nbsp; Some are relative, some require you to specify something inside the 12 hive.&amp;nbsp; It takes some getting used to.&amp;nbsp; In this case, if you are copying additional files into a feature folder for a web part, you would specify something like &lt;em&gt;FEATURES\MyFeature\mywebpart.webpart&lt;/em&gt;.&lt;/p&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TemplateFiles&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TemplateFile&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Location&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;FEATURES\MyFeature\MyWebpart.webpart&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TemplateFiles&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p&gt;The &lt;em&gt;Assemblies&lt;/em&gt; element specifies which binaries will be deployed to SharePoint and where.&amp;nbsp; You can copy multiple assemblies out at a time with a feature by specifying more than one &lt;em&gt;Assembly&lt;/em&gt; element.&amp;nbsp; The &lt;em&gt;Assembly &lt;/em&gt;element has a Location attribute which typically just contains the DLL name (again dependent on where the DLL is copied in your DDF file).&amp;nbsp; It also contains a &lt;em&gt;DepoymentTarget &lt;/em&gt;attribute which specifies wether to copy it to the GAC (&lt;em&gt;GlobalAssemblyCache&lt;/em&gt;) or the bin folder (&lt;em&gt;WebApplication&lt;/em&gt;).&amp;nbsp; It also contains a SafeControls element with the same syntax of what is used in the web.config.&amp;nbsp; &lt;/p&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Assemblies&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Assembly&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;DeploymentTarget&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;WebApplication&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Location&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MySolution.dll&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SafeControls&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SafeControl&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Assembly&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MySolution, Version=1.0.0.0, Culture=neutral&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Namespace&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MySolution.WebParts&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;TypeName&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;*&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Safe&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;True&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SafeControls&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Assembly&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Assemblies&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p&gt;One thing to note here is that if you do not specify at least one assembly with a SafeControl element, SharePoint will decide that your solution does not contain a &lt;em&gt;Web Application Resource&lt;/em&gt; and therefore will not deploy it when you specify a URL with stsadm.&amp;nbsp; So, I typically include this line even if I don&amp;#39;t have any controls or web parts in my solution.&amp;nbsp; You will get an error like the one below.&lt;/p&gt; &lt;p&gt;&lt;em&gt;This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application.&lt;/em&gt;&lt;/p&gt; &lt;p&gt;The last element, I am will talk about is &lt;em&gt;CodeAccessSecurity&lt;/em&gt;.&amp;nbsp; This of course is the most complex one.&amp;nbsp; I have posted on this &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2007/07/05/how-to-configure-code-access-security-for-a-web-part.aspx"&gt;topic&lt;/a&gt; in the past and don&amp;#39;t forget, I will be &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/09/02/speaking-at-tulsa-tech-fest-again.aspx"&gt;speaking&lt;/a&gt; about it next month.&amp;nbsp; The post I have on it covers it in more detail that I will cover today.&amp;nbsp; The one thing, I will remind you of is that it is ok to specify multiple assemblies.&amp;nbsp; &lt;/p&gt; &lt;p&gt;I haven&amp;#39;t talked about the root element yet. It&amp;#39;s pretty simple.&amp;nbsp; Just remember the &lt;em&gt;SolutionId&lt;/em&gt; needs to be unique.&amp;nbsp; The &lt;em&gt;ResetWebServer&lt;/em&gt; attribute can be set to false if you don&amp;#39;t want it to reset IIS on deployment.&lt;/p&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Solution&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;SolutionId&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;{B3270C0DF-EACA-4320-9B2A-C293435C5DF1}&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:red;"&gt;xmlns&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;http://schemas.microsoft.com/sharepoint/&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;ResetWebServer&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;true&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p&gt;Anyhow, hopefully this will help someone out the next time they are looking at a manfiest.xml file.&lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=678" width="1" height="1"&gt;</description><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Code+Access+Security/default.aspx">Code Access Security</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Deployment/default.aspx">Deployment</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Solution/default.aspx">Solution</category></item><item><title>Avoid Comments in a SharePoint Deployment Manifest</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2007/07/05/avoid-comments-in-a-sharepoint-deployment-manifest.aspx</link><pubDate>Thu, 05 Jul 2007 17:42:35 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:46</guid><dc:creator>C-Dog's .NET Tip of the Day</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dotnetmafia.com/blogs/dotnettipoftheday/rsscomments.aspx?PostID=46</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2007/07/05/avoid-comments-in-a-sharepoint-deployment-manifest.aspx#comments</comments><description>In order to properly install a web part with Code Access Security, it is necessary to create a deployment solution. My next post will cover these and the proper way to specify code access security for a web part. In the meantime though, I wanted to post...(&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2007/07/05/avoid-comments-in-a-sharepoint-deployment-manifest.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=46" width="1" height="1"&gt;</description><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Code+Access+Security/default.aspx">Code Access Security</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Deployment/default.aspx">Deployment</category></item></channel></rss>