Sandeep's Blog: This blog is no longer updated, please visit http://sandeepnakarmi.com.np for latest posts

September 13, 2009

VSeWSS Service Error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Filed under: VseWss 1.3 March CTP — sandeep nakarmi @ 10:11 AM

I was working on VseWSS 1.3 March CTP version and i was trying to add the Enterprise logging ability in sharepoint web parts. Since in VseWSS 1.3 has the feature that the referenced assemblies are also included in package and are installed in GAC, i opted with this version, other wise i was working with version 1.2.

So in order to add the logging feature, i just created a new sharepoint web part project and referenced the following enterprise library references in the project.

  • Microsoft.Practices.EnterpriseLibrary.Logging.dll
  • Microsoft.Practices.EnterpriseLibrary.Common.dll
  • Microsoft.Practices.ObjectBuilder2.dll

Having created a simple hello world webpart, i tried to deploy the project. But just then, this error occurred.

Error 1 VSeWSS Service Error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Log file written to: C:\Windows\system32\config\systemprofile\AppData\Roaming\Microsoft\VSeWSS 1.3\VSeWSS1.3 service.log 

After searching a bit on the web, i was very disappointed that this is yet another problem in version VseWSS 1.3. The only solution for this was to add the assemblies to GAC manually, clean the project and perform iisreset. Then only it worked.

See the following links for references:

 Well i am looking for alternatives as a work around for this. May be the post build script solution suggested in the link above. :-(

September 10, 2009

How to create a custom site template with auto created list using visual studio extension for wss

Filed under: VseWss 1.3 March CTP — sandeep nakarmi @ 8:12 AM

 In this article, I will show you in steps how you can create a custom site definition with an auto created list that can be deployed easily as a solution file to sharepoint. 

I am using Visual Studio 2008 extension for WSS 3.0 v1.3 March CTP. You can follow these steps using VSEWSS v1.2 as well.

1) Create a new project of type “Sharepoint “ in visual studio. Select “Blank Site Definition”. Name the project as “DemoSite”. 

2) This will create a default “onet.xml” , “default.aspx” file and feature receiver files. Before working with “onet.xml” file, it is very necessary to come in terms with the structure of the onet.xml file. 

a

3) Delete the “SiteProvisioning Handler” folder. This is not needed for the purpose of this article. Use this if you need to add custom code and behavior when the site is being provisioned. 

4)  Go to “View->Other Windows->WSP View”. In the WSP view, you will see an additional file named “webtempDemoSite.xml”. Open this file. This file contains the configuration details of the “DemoSite”. You can have a look at the “webtemp.xml” file for a reference in location below: 

a

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\TEMPLATE\1033\XML 

5) Make the following change to the file.

a

6) f you want to see the effect of the above change, build the project and select deploy (Right click-> Build and Right click – > Deploy).

7) Try creating a new site from SharePoint and you will see a new category and template to select while creating a site. Notice the description, template category and template.

a

8) Fill in the title, description, url and other parameters and create the site. 

a

9) Since we chose to create a “blank site definition” there are no lists created. So, let’s now try to add a document library that will be auto created when a site is created from this site definition. In the “DemoSite” project,  add a new item of type Sharepoint-> ListInstance and name it “DocumentLibraryInstance”.

a

10) Creating a ListInstance, will create the list automatically when the site is created. In the popup wizard select “Document Library”.

a

11) Make the following modifications to the newly created instance.xml file.Note the changes to the Title, url and description. Also, I want to show the created library to quick launch so I have added the OnQuickLaunch attribute to True

a

12) The list instance will be deployed to SharePoint as a feature. You can have a look at the SharePoint feature xml file in the WSP view. The feature will be deployed in “Web” scope. 

a

13) Go to WSP view -> DemoLib->Feature.xml. See that the scope of the feature is “Web”.

a

14) Copy the FeatureId.  In DemoSite->onet.xml file, find the node “WebFeatures” of configuration node with and add a new Feature node with the copied id like below. Since the fature is “Web” scoped, we place the feature in “WebFeatures” element. This will activate the web feature when site is created, and activating this feature will create the list instance document library DemoLib.

a

15) Create a new site collection of type DemoSite. See that now, creating a new site auto created a new document library DemoLib.

a

16) Go to SiteActions-> Site Settings – > Site Features to see the DemoLib feature installed and activated.

a

17) Also following files will be created if you have a look at the SharePoint 12 hive. Those files were created when we deployed the project into SharePoint.  The entire project is deployed as a solution file (WSP) into SharePoint. You can view this in the Solution Management section in central administration site.

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\TEMPLATE\1033\XML \ webtempDemoSite.xml

C:\Program Files\Common Files\microsoft shared\Web Server Extensions \12 \ TEMPLATE \ SiteTemplates \ DemoSite 

a

 You can retract or revoke your solution directly from this UI.

How to create a custom site definition with a custom master page that can be easily deployed as a solution to SharePoint.

Filed under: Sharepoint 2007, VseWss 1.3 March CTP — sandeep nakarmi @ 7:57 AM

In this walkthrough topic, I will demonstrate you how to achieve the following things:

  • Create a custom site definition.
  • Specify your own master page to be used for that site.
  • Create a solution file(wsp) that can be easily deployed to sharepoint.

In this artice, I will not cover how to create a master page. I will just demonstrate how you can create a feature to deploy the custom master page and apply it to a site.

If you want to know about the types of master pages, creating one yourself in detail, follow this 6 part series on Master Page.

http://sharepointmagazine.net/technical/development/introduction-to-master-pages

The main objective of this post is not how to create a master page, but how you can create your custom site definition that has custom master page and deploy into SharePoint as a solution.

I am using Visual Studio 2008 Extension for WSS 3.0 v1.3 March CTP. You can use earlier version of this tool or use other tool like WSPBuilder. You will have to know how to use the tool.

Since I will not be creating a master page, I am going to use one of the sample master pages  provided by Microsoft. Download extract the master pages. I will be using the “block” sample master page.

So let’s start.

1)  Create a new project of type SharePoint and use the template “Team Site Definition”.

a

2) The template will create the default templates that are necessary to create a team site.There is also a folder named “Site Provisioning Handler”. We will not be using this for now so you can delete this folder.

a

3) This is how it looks in the WSP view (View->Other windows->WSP View).

a

4) Inside Site Definition folder, create a folder named “MasterPage” and add the master page file “block_lay4_blue.master” which was extracted from sample master pages. I have renamed the master page file to “customsite.master”.

a

5) In the WSP view, make the following changes to the elementManifest.xml file. Here we specify that the master page is to be added to the master page gallery of the site.

a

6) Next specify the folder where the images for the custom master page will be deployed in sharepoint. Normally this will be in “12\TEMPLATE\IMAGES” folder. So we create a folder named “CustomSite” in this path and put our images there. Create a hierarchy as shown below and put there the image files. Since the master page I chose was of theme blue, I chose the images only relevant for this mater page.

a

7) Similarly create a folder named “CustomSite” inside the “TEMPLATE\LAYOUTS\STYLES” directory. This folder will contain the styles used by the master page. 

a

8) Now since we have defined the place for images and the styles, let’s modify the master page to reference the necessary images and css file t the new location. Open the customsite.master page file and do the following: 

  a.  Update the reference for css files to the reference from layouts folder. Make the following change.

  Original

a

Modified

a

b. Search for the text below and update it 

  • src=”../../images/questionMark.gif” to src=”/_layouts/images/CustomSite/questionMark.gif”

c. Now look for any references that need to be updated in the css files. Open the file “color_layout4_blue.css” and update the following image references. 

  • “../images/lay4_blue_logo.gif”) to “/_layouts/images/CustomSite/lay4_blue_logo.gif”
  • “../images/lay4_blue_hover.gif” to “/_layouts/images/CustomSite/lay4_blue_hover.gif”
  • “../images/lay4_blue_nav_bg.gif” to “/_layouts/images/CustomSite/lay4_blue_nav_bg.gif”

d. Open the file template_layout4.css and make the following change.

  • “../images/lay4_stock.jpg” to “/_layouts/images/CustomSite/lay4_stock.jpg”

9) Till now we have create a site definition feature, add a custom master page with its necessary image and css files and updated the references according to the deployment of the files. Now we need to specify in the site definition the master page to use for the site.

10) Open the Onet.xml file and look for the “Configurations” node in the xml file.

a

You will see that there is a Configuration with ID=0 and name “Default”.

11) Add the following attributes to the Configuration node.

a 

Here we specified that the site with configuration ”0” would use the master page customsite.master The master page will be present in master page gallery. Step 5. 

12) Expand the WebFeatures node and add an entry for the master page feature within this section. To get the ID, go to the WSP view, open the feature.xml file and copy the id of the feature.

 a

      a

13) With this,  build and deploy the project. Go to project->properties->Debug and specify the url of a site in the “Start browser with URL” section. Build and deploy the project.

a

14) After deployed successfully, create a new subsite. Select the Deployment category and select the customsite template.

a 

15) See that the newly created site is aplied with the custom master page that we specified.

a

Go to the master page gallery in the site collection and see that the master page “customsite.master” has been added to the gallery.

a  

Go to the Operaitons->Solution Management section in the central admin web site to see the solution installed.

a

 Enjoy !!! :-)

September 3, 2009

VSEWSS 1.3 March CTP: System.ArgumentNullException: Value cannot be null.

Filed under: VseWss 1.3 March CTP — sandeep nakarmi @ 8:55 AM

I was working on a solution created in VseWss 1.3 March CTP.  Then i had a requirement that needed me to re-install the sharepoint. SO i just re-installed SharePoint2007.

Then i opened up the previous VseWss solution, and when i tried access “WSP View”, it just throw me following error. Whether i deploy, access WSP View, refresh, it just throw me this error which was logged in VseWSS1.3 log file.

Error: System.ArgumentNullException System.ArgumentNullException: Value cannot be null. Parameter name: uri at System.ServiceModel.EndpointAddress..ctor(String uri) at Microsoft.SharePoint.Tools.Utilities.SPProxy.GetSPServiceProxy() at Microsoft.SharePoint.Tools.SharePointSolutions.AssemblyFeatureElementDirector.Constract() at Microsoft.SharePoint.Tools.SharePointSolutions.AssemblyFeatureDirector.GetFeatureElement(ICollection`1 directors) at Microsoft.SharePoint.Tools.SharePointSolutions.AssemblyFeatureDirector.Constract() at Microsoft.SharePoint.Tools.SharePointSolutions.AssemblySolutionDirector.ConstractElements() at Microsoft.SharePoint.Tools.SharePointSolutions.AssemblySolutionDirector.Constract() at Microsoft.SharePoint.Tools.SharePointSolutions.SolutionCreator.CreateCore(ISPProject project, IDirectorCreator creator) at Microsoft.SharePoint.Tools.SharePointSolutions.SolutionCreator.Create(ISPProject project) at Microsoft.SharePoint.Tools.Forms.SPToolWindow.CreateSolutions()

I didn’t have any clue what was wrong and what i had to do. At last, i just uninstalled VseWss 1.3 and installed it again. And it was working again. Dont have any clue what went wrong.

Theme: Shocking Blue Green. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.