Pat’s .Net and Sharepoint Blog
In the Microsoft Sharepoint and .Net Trenches

Creating a Custom Action and Custom Sharepoint Application Page using VSEWSS 1.1

February 26th, 2008 . by <Patrick/>

I love the deploy functionality built in to Visual Studio Extensions for Windows Sharepoint Services. It makes creating solution files so much easier. Creating manifest.xml files, using makecab.exe blah blah blah - what a headache! With every blog out there someone has a different way of creating it ie using ms build some third party tool from CodePlex, using .bat and .cmd files - Brutal!!

Anyways all was fine and dany I was pumping out webparts, lists, custom fields etc but then I tried deploying a custom application page and a custom action.

I created the following folder structure Template/Layouts/CustomAppPage and then put my .aspx file there but when deploying the solution VS was not copying the file to the 12 hive Layouts directory. When I checked out the WSP view my features and files were not there.

After a long time I finally realized what I was doing wrong. I first created my aspx file, feature and elements files in one project and then just copied them and added them to my new Empty Sharepoint solution.

What you need to always do is in Solution Explorer right click and then Add Item

For Application pages use the Template item for Elements.xml files use the Module item. Have Visual Studio create the files and then just copy and paste your existing code into them.

Now you should see your features in WSP view. Hit F2 to rename the the features and elements appropriately.


Minimal Masterpage

February 26th, 2008 . by <Patrick/>

<%– Identifies this page as a .master page written in C# and registers
tag prefixes, namespaces, assemblies and controls. –%>
<%@ Master language=”C#” %>
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”
“http://www.w3.org/TR/html4/loose.dtd”>
<%@ Import Namespace=”Microsoft.SharePoint” %>
<%@ Register Tagprefix=”SPSWC” Namespace=”Microsoft.SharePoint.Portal.WebControls” Assembly=”Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
<%@ Register Tagprefix=”SharePoint” Namespace=”Microsoft.SharePoint.WebControls” Assembly=”Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
<%@ Register Tagprefix=”WebPartPages” Namespace=”Microsoft.SharePoint.WebPartPages” Assembly=”Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
<%@ Register Tagprefix=”PublishingWebControls” Namespace=”Microsoft.SharePoint.Publishing.WebControls” Assembly=”Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
<%@ Register Tagprefix=”PublishingNavigation” Namespace=”Microsoft.SharePoint.Publishing.Navigation” Assembly=”Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
<%@ Register TagPrefix=”wssuc” TagName=”Welcome” src=”~/_controltemplates/Welcome.ascx” mce_src=”~/_controltemplates/Welcome.ascx” %>
<%@ Register TagPrefix=”wssuc” TagName=”DesignModeConsole” src=”~/_controltemplates/DesignModeConsole.ascx” mce_src=”~/_controltemplates/DesignModeConsole.ascx” %>
<%@ Register TagPrefix=”PublishingVariations” TagName=”VariationsLabelMenu” src=”~/_controltemplates/VariationsLabelMenu.ascx” mce_src=”~/_controltemplates/VariationsLabelMenu.ascx” %>
<%@ Register Tagprefix=”PublishingConsole” TagName=”Console” src=”~/_controltemplates/PublishingConsole.ascx” mce_src=”~/_controltemplates/PublishingConsole.ascx” %>
<%@ Register TagPrefix=”PublishingSiteAction” TagName=”SiteActionMenu” src=”~/_controltemplates/PublishingActionMenu.ascx” mce_src=”~/_controltemplates/PublishingActionMenu.ascx” %>
<%– Uses the Microsoft Office namespace and schema. –%>
<html>
  <SharePoint:RobotsMetaTag runat=”server”/>
  <%– The head section includes a content placeholder for the page
  title and links to CSS and JavaScript files that run on the server. –%>
  <head runat=”server”>
    <asp:ContentPlaceHolder runat=”server” id=”head”>
  <title>
        <asp:ContentPlaceHolder id=”PlaceHolderPageTitle” runat=”server” />
      </title>
    </asp:ContentPlaceHolder>
    <Sharepoint:CssLink runat=”server”/>
    <asp:ContentPlaceHolder id=”PlaceHolderAdditionalPageHead” runat=”server” />
  </head>
  <body onload=”javascript:_spBodyOnLoadWrapper();”>
  �
    <form runat=”server” onsubmit=”return _spFormOnSubmitWrapper();”>
   �
     <WebPartPages:SPWebPartManager runat=”server”/>
      <wssuc:Welcome id=”explitLogout” runat=”server”/>
      <PublishingSiteAction:SiteActionMenu runat=”server”/>
      <PublishingWebControls:AuthoringContainer id=”authoringcontrols”  runat=”server”>
      <PublishingConsole:Console runat=”server” />
      </PublishingWebControls:AuthoringContainer>
    �
   �
      <asp:ContentPlaceHolder id=”PlaceHolderMain” runat=”server” />
      <asp:Panel visible=”false” runat=”server”>
        <asp:ContentPlaceHolder id=”PlaceHolderSearchArea” runat=”server”/>
        <asp:ContentPlaceHolder id=”PlaceHolderTitleBreadcrumb” runat=”server”/>
        <asp:ContentPlaceHolder id=”PlaceHolderPageTitleInTitleArea” runat=”server”/>
        <asp:ContentPlaceHolder id=”PlaceHolderLeftNavBar” runat=”server”/>
        <asp:ContentPlaceHolder ID=”PlaceHolderPageImage” runat=”server”/>
        <asp:ContentPlaceHolder ID=”PlaceHolderBodyLeftBorder” runat=”server”/>
        <asp:ContentPlaceHolder ID=”PlaceHolderNavSpacer” runat=”server”/>
        <asp:ContentPlaceHolder ID=”PlaceHolderTitleLeftBorder” runat=”server”/>
        <asp:ContentPlaceHolder ID=”PlaceHolderTitleAreaSeparator” runat=”server”/>
        <asp:ContentPlaceHolder ID=”PlaceHolderMiniConsole” runat=”server”/>
        <asp:ContentPlaceHolder id=”PlaceHolderCalendarNavigator” runat =”server” />
        <asp:ContentPlaceHolder id=”PlaceHolderLeftActions” runat =”server”/>
        <asp:ContentPlaceHolder id=”PlaceHolderPageDescription” runat =”server”/>
        <asp:ContentPlaceHolder id=”PlaceHolderBodyAreaClass” runat =”server”/>
        <asp:ContentPlaceHolder id=”PlaceHolderTitleAreaClass” runat =”server”/>
       </asp:Panel>
    </form>
  </body>
</html>