Archive

Archive for the ‘SharePoint Tools’ Category

How to find which w3wp.exe to attach when debugging your SharePiont2010 project

March 22, 2012 3 comments

When debugging SharePoint2010 project, you need to attach w3wp.exe process, however there are often quite a few of them and it is very hard to figure out which one to attach. Today, I will show you how to find out which process to attach using a tool called process explorer.

1. Download the process explorer and run it after you download it.

2. Find the w3wp.exe processes under wininit.exe right-click the columns header and click Select Columns.

3. Include Command Line under Process Image.

4. Now you can see your IIS site name next to w3wp.exe, in my case I’d like to attach the “SharePoint – BenDev80”.You can see the PID of the process is 2920.

5. From the above process you know the process ID you’d like to attach is 2920, you can then go ahead to attach the process from Visual Studio.

Avoid Memory Leaks in SharePoint2010 Development

June 6, 2011 Leave a comment

When you develop SharePoint solution using code, you need to Dispose SPWeb appropriately to avoid memory Leaks. The general guideline for this are:

Dispose Not to dispose
OpenWebEnumerating Webs or AllWebs ParentWebRootWeb

SPWeb from SPContext

There are more rules than the one list above and as a smart SharePoint developer, you do not have to memories all the rules .There is a tool called SharePoint Dispose Checker which can help you to find potential memory leak.

To use SPDisposeChecker in you solution, you need to download the tool from MSDN Code Gallery and install it in your development machine as follow.

1. Run the installer with elevated privilege.

2. Accept the agreement and click next.

3. Select those two options and click next.

4. Select Everyone and click Next.

5. Go to Toolsà SharePoint Dispose Check to Configure the SPDisposeCheck.

6. You can change the Treat problems as Errors to Warnings.

7. after clicking Save, you are all set to use the tool.Recompile my project , I can get the result below.

References:

SharePoint 2007/2010 “Do Not Dispose Guidance” + SPDisposeCheck

Reverse-engineer SharePoint fields, content types and list instance—Part2

June 5, 2011 Leave a comment

Reverse-engineer SharePoint fields, content types and list instance—Part1

Reverse-engineer SharePoint fields, content types and list instance—Part2

Reverse-engineer SharePoint fields, content types and list instance—Part3

Reverse-engineer SharePoint fields, content types and list instance—Part4

In the part1 of this series, I demonstrated how to use VS2010 to Reverse-engineer SharePoint fields, content types and list instances. In the part 2 of this series, I will demonstrate how to do the same using CKS:Dev. CKS:Dev extends the Visual Studio 2010 SharePoint project system with advanced templates and tools. Using these extensions you will be able to find relevant information from your SharePoint environments without leaving Visual Studio. You will have greater productivity while developing SharePoint components and you will have greater deployment capabilities on your local SharePoint installation.

You can download the complete solution here.

1. First, download and install appropriate CKS:Dev from CodePlex.

If you are using SharePoint Foundation 2010 then download and install the SharePoint Foundation 2010 version

If you are using SharePoint Server 2010 then download and install the SharePoint Server 2010 version

2. After installation, you need to restart your visual studio and create empty SharePoint.

3. Go to Viewà Server Explorer

4. Add SharePoint web application connection to the server explorer.

5. After add the connection, you can browse to see the contents for the Web Application.

6. Go to Site Columns à YBBEST (Custom Group of you own choice) and right-click the YBBEST Folder and Click Import Site Columns.

7. Go to ContentTypesà YBBEST (Custom Group of you own choice) and right-click the YBBEST Folder and Click Import Content Types.

8. After the import completes, you can find the fields and contentTypes in the SharePoint project below. Of course you need to do some modification to your current project to make it work.

9. Next, create list instances using list instance item template in Visual Studio

10. Finally, create lookup columns using the feature receivers and the final project will look like this.

You can download the complete solution here.

Tools for SharePoint2010 Developers

March 31, 2011 Leave a comment

I use the following tools on pretty much every SharePoint project I am working on and I’d like to share it with all the SharePoint devs and hopefully it will make your life a bit easier.

  1. The SharePoint Manager 2010 is a SharePoint object model explorer. It enables you to browse every site on the local farm and view every property.

    It also enables you to change the properties.

  2. This project extends the Visual Studio 2010 SharePoint project system with advanced templates and tools. Using these extensions you will be able to find relevant information from your SharePoint environments without leaving Visual Studio. You will have greater productivity while developing SharePoint components and you will have greater deployment capabilities on your local SharePoint installation.

  3. ULSViewer allows users to open a ULS log file and display its contents in a user friendly format. Users can then perform advanced functions such as filtering, sorting, highlighting, loading logs, appending logs, etc in order to single out the data that is important to the user. This information can be used to diagnose problems with machines running ULS services, or to monitor machines and the events they create in realtime.

  4. Process Explorer shows you information about which handles and DLLs processes have opened or loaded.

  5. SPDisposeCheck is a tool that helps developers and administrators check custom SharePoint solutions that use the SharePoint Object Model helping measure against known Microsoft dispose best practices. This tool may not show all memory leaks in your code and may produce false positives which need further review by subject matter experts.

  6. The Visual Studio 2010 SharePoint Power Tools is a set of templates and extensions that provides additional functionality to SharePoint developers who use the SharePoint developer tools in Visual Studio 2010.Below is the list of features included in the current release of the power tools.

    Sandboxed-compatible Visual Web Part
    This item template enables you to use a visual designer to create SharePoint web parts that can be deployed in a sandboxed solution for SharePoint 2010.

    Sandboxed Compilation
    This extension displays build errors when you use types or members in a SharePoint 2010 sandboxed project which are not allowed in the SharePoint sandbox environment.

  7. The CAML.NET IntelliSense extensions for Visual Studio 2010 is simply a must-have for SharePoint developers. It can help you tame that sometimes finicky, but ever-so-essential CAML language we all know and love.

  8. Build and test CAML Queries for SharePoint interactively with the U2U CAML Query Builder.CAML (Collaborative Application Markup Language) is an XML-based query language that helps you querying, building and customizing Web sites based on Windows SharePoint Services. The XML elements define various aspects of a WSS site.The tool will help you build, test and execute your CAML Queries. Detailed documentation is included in this document. This version of the tool only let you build CAML queries for execution against lists.

  9. Build and test CAML Queries for SharePoint interactively with the U2U CAML Query Builder.CAML (Collaborative Application Markup Language) is an XML-based query language that helps you querying, building and customizing Web sites based on Windows SharePoint Services. The XML elements define various aspects of a WSS site.The tool will help you build, test and execute your CAML Queries. Detailed documentation is included in this document. This version of the tool only let you build CAML queries for execution against lists