About Me

Having 12 years experience in Microsoft technologies.Since more than 7 years working in SharePoint technologies. Expert in providing consultation for SharePoint projects. Hands on with development and administration.

Monday, 17 October 2011

Set Up a SharePoint 2010 Development Environment in various operating systems

Setting Up a Development Environment for SharePoint 2010
There are several ways to set up a development environment. It depends on whether you’re on a team or you’re a single developer, and whether you work for an enterprise or a small shop. First, consider your own development machine. The whole process of coding, packaging, installing, and running a SharePoint component takes time.
Working Outside a Server
When developing for SharePoint, the first impression is often that a new 64-bit development machine is required to run the server and the development environment together. We’ll examine this scenario and its advantages and disadvantages in the next sections. The simplest option is to keep your client machine and work against a remote server running SharePoint. It makes you independent of local configuration requirements and reduces your cost outlay, particularly for your first, simpler projects.
 As a preview, the different outputs are
•Web Parts
• Application pages
• Custom fields
• Controls
A legitimate concern as a developer on a disconnected machine is, “Won’t my SharePoint projects
require dependencies from SharePoint assemblies?” The most common development targets, Web Parts, have no such dependency. You simply derive your control from the ASP.NET WebPart class and use the SharePoint web services to access data. While this is not the most powerful tool set, it’s easy to set up and maintain.
For a more professional and versatile environment, consider using a remote development
Considering Remote Development
Whatever configuration you choose, you should try to develop on your own server machine. That’s the only way to get the Visual Studio 2010 F5 deployment feature. It makes your development cycles shorter and increases productivity.
For a team-working arrangement there are several extra prerequisites. SharePoint 2010 is a 64-bit–
only product. That means your whole environment must run on 64 bits. If this is overkill, there are
alternatives. We strongly recommend setting up a virtual server on a physical machine, such as Hyper-V or VMware on Windows Server 2008. Create your virtual development machines there and access them remotely. A cheap Windows 7 machine will suffice as such a client computer. SharePoint projects occasionally crash the server during heavy development. Re-creating a virtual machine is much easier than losing your whole personal computer.
Installation Scenarios
The following installation scenarios list the options you currently have to install SharePoint as a core
component of a development environment. The 64-bit prerequisite limits the choice of operating system to the following:
• Windows Server 2008 x64
• Windows Server 2008 R2 x64
• Windows Vista x64
• Windows 7 x64
Developer Workstation on Windows Server 2008
The following list is the minimum needed for a working SharePoint development system. Depending on your specific needs, you may need to install additional components. The order is obligatory—meaningthat SharePoint must be installed before Visual Studio. The help files are, of course, optional.
1. Install Windows Server 2008 x64.
2. Configure, at a minimum, the Web Server role.
3. Install SharePoint.
4. Install Visual Studio 2010.
5. Install help files and sample code if desired.
The server is now ready to act as a powerful development machine.

Developer Workstation on Windows Vista or Windows 7
The following section details the more complicated process to install SharePoint on Windows Vista or Windows 7. These instructions are intended for professional developer workstations and follow
Microsoft’s recommendations for such a development environment running Visual Studio 2010 and
SharePoint Server 2010 on the same machine.
There are two limitations with this development environment: you cannot create a SharePoint 2010
farm, and SharePoint 2010 must not run in production on Windows Vista or Windows 7.
Be sure to run all the installation steps as a local machine administrator.
The recommended machine configuration is
• x64-compatible CPU (64 bit)
• Windows 7 x64 or Windows Vista SP1 (or SP2) x64
• 2GB of RAM minimum (4GB recommended)
Start with the SharePoint.exe file for SharePoint Foundation or SharePoint Server 2010. Extract the
files from SharePoint.exe with the following command line. A user account control (UAC) prompt might appear at this point.
SharePoint.exe /extract:c:\SharePointFiles
This extracts all of the installation files to your hard drive. Use a folder you can recognize easily later, such as c:\SharePointFiles. This allows you to repeat the installation steps without extracting the package again and enables access to the configuration file that needs tweaking, to permit installation on
Windows Vista or Windows 7:
Add the following line to the end of the config.xml file:
<Setting Id="AllowWindowsClientInstall" Value="True"/>
The complete file should now look like this:
<Package Id="sts">
<Setting Id="SETUPTYPE" Value="CLEAN_INSTALL" />
<DATADIR Value="%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\14\Data" />
<Logging Type="verbose" Path="%temp%" Template="Microsoft Windows
SharePoint Services 4.0 Setup *.log" />
<Setting Id="UsingUIInstallMode" Value="1" />
<Setting Id="SETUP_REBOOT" Value="Never" />
<Setting Id="AllowWindowsClientInstall" Value="True"/>

If you miss this step, you will see an error dialog when you run the installation.
Steps for Vista SP1 Only
These three components are not required on Windows 7, because they are included with the operating system. For Vista with no service pack or SP1 only, they are required.
First, install the .NET Framework 3.5 SP1 from http://download.microsoft.com/download/2/
Second, install PowerShell x64 from www.microsoft.com/downloads/details.aspx?FamilyID=
Third, install the Windows Installer 4.5 redistributable from www.microsoft.com/downloads/details.
Installing Required Windows Features
The SharePoint 2010 prerequisite installer does not run on Windows Vista or Windows 7. You must
manually configure the necessary Windows features and install the requisite software. The requirements include enabling almost all the IIS (Internet Information Services) features. Instead of checking almost all the boxes in the IIS section in Windows Features, you can enable them programmatically. At a command prompt, paste in the following command (for clarity the options are shown line by line, though you’re supposed to enter them as a single line):
start /w pkgmgr /iu:IIS-WebServerRole; IIS-WebServer;
IIS-CommonHttpFeatures; IIS-StaticContent;
IIS-DefaultDocument; IIS-DirectoryBrowsing;
IIS-HttpErrors; IIS-ApplicationDevelopment;
IIS-ASPNET; IIS-NetFxExtensibility;
IIS-ISAPIExtensions; IIS-ISAPIFilter;
IIS-HealthAndDiagnostics; IIS-HttpLogging;
IIS-LoggingLibraries; IIS-RequestMonitor;
IIS-HttpTracing; IIS-CustomLogging;
IIS-Security; IIS-BasicAuthentication;
IIS-WindowsAuthentication; IIS-DigestAuthentication;
IIS-RequestFiltering; IIS-Performance;
IIS-HttpCompressionStatic; IIS-HttpCompressionDynamic;
IIS-WebServerManagementTools; IIS-ManagementConsole;
IIS-IIS6ManagementCompatibility; IIS-Metabase;
IIS-WMICompatibility; WAS-WindowsActivationService;
WAS-ProcessModel; WAS-NetFxEnvironment;
This may take some time. When it is finished, your Windows Features dialog settings should look like
A reboot is required after the Windows Features update. Next, install FilterPack by running the
This command runs a Windows installer application. There are no configuration steps—it simply
installs its contents.
Install Windows Identity Foundation (WIF). This framework was formerly known by the code name
Geneva. This is an update package and it’s described in Knowledge Base article KB974405. It also has no configuration settings. The SharePoint Foundation needs the Microsoft.IdentityModel assembly with version
Installing and Configuring SharePoint
Now you’re ready to install SharePoint 2010 using setup.exe. After the start screen, you must accept the license terms. In the next step, choose Standalone as the server type

When the installer ends, you will be prompted to optionally start the SharePoint Products and
Technologies Configuration wizard. With the check box checked, click Close to run it,

The wizard leads you through several steps:
1. A splash screen outlines the information you might have to provide. Clicking Next displays a warning that installation on a client operating system does not support a production SharePoint environment

2.After this a second warning appears—explaining that several services might be restarted—confirm by clicking Yes.
3. Next, choose “Create a new server farm.
4. A standalone version runs on the internal embedded SQL server, requiring no further information. Otherwise, SQL Server 2008 Express is used, and you will need to enter the database server name, username, and password.
5. Let the wizard complete the remaining steps. No additional information is required. After this, Central Administration loads.
If the configuration is successful, you should install SQL Server 2008 SP1. If you install Visual Studio
2010 in the next step, this is not required, as the current release comes with the required service packs
for SQL Server 2008 Express.
When it finishes, create a new SharePoint site using SharePoint 4.0 Central Administration under
Administrative Tools.
Installing Visual Studio 2010
Now install Visual Studio 2010 and the SharePoint development tools. The tools add several useful
templates for creating SharePoint objects. The installation is straightforward, though you’ll need to
restart the computer once in the middle of the installation cycle.
Team Development
For team development, each team member needs access to the same code. Setting up a Team
Foundation Server with its source code management feature is part of the solution. Each person should add his or her development machine as a farm computer to the SharePoint installation.
There should be one database server. It can run Central Administration, too. In large teams, we
recommend restricting access to Central Administration to one or two people, not necessarily
developers. You must ensure that the developers only use tools, plug-ins, features, and even Web Parts that are approved by the administrator to run on the production machine. The benefit is a much smoother deployment process later.
Optimizing Your Development Experience
Even on a fast machine, the development experience could be better. SharePoint is optimized for
servers, and it runs a lot of background services that are not needed during development, so you could turn them off. There are a few exceptions—for example, when testing a deployment scenario, the SPTimer service might be needed in a farm environment. In the most common installations, such an optimization provides noticeable advantages.
To have the services available when they’re needed, we recommend you create a suitable batch file.
You can easily start up the server, stop the services, and restart later. Rather than stopping services
manually in the Services snap-in and setting them to Manual, run a console command:
c:>net stop <Service>
The following services are not normally required on a development machine (the names are in the
form that you’d use them from the command line):
• WebAnalyticsService
• OSearch14
• SPUserCodeV4
• SPSearch4
• SPTimerV4
• SPTraceV4
• FontCache3.0.0.0
• ReportServer
• mqsvc
• ntfrs
• PresentationFontCache
• sqlwriter
• ExcelServerWebService
Some services might not be installed or may already be stopped, depending on your machine’s
configuration. You can safely ignore such services.
Preparing to Use .NET 3.5
By default, SharePoint compiles using the C# 2.0 compiler. If you create an assembly using the 3.5
settings, you have all features of the C# 3.5 language available. However, if you have pages with
embedded code, such as generic handler or web services, the ASP.NET compiler uses .NET 2.0. Features such as the var keyword will not work. To overcome this limitation, you must extend the settings in the web.config file. It’s recommended to set this on a per–site collection basis to avoid side effects. The corresponding web.config can be found in the appropriate VirtualDirectory folder of IIS.
First, add the following section anywhere beneath the <configuration> node:
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=,
Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5" />
<providerOption name="WarnAsError" value="false" />
This sets the required compiler version to 3.5.
Second, look for the <assemblies> node and compare carefully the list of assemblies, as shown here:
<compilation batch="false" debug="false">
<add assembly="System.Core, Version=,
Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Data.DataSetExtensions, Version=,
Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Extensions, Version=,
Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Xml.Linq, Version=,
Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="Microsoft.SharePoint, Version=,
Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add assembly="System.Web.Extensions, Version=,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Microsoft.Web.CommandUI, Version=,
Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add assembly="Microsoft.SharePoint.Search, Version=,
Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add assembly="Microsoft.Office.Access.Server.UI, Version=,
Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add assembly="Microsoft.SharePoint.Publishing, Version=,
Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
The list might look slightly different on your system. You can extend the list if you need other parts
of .NET 3.5 in your project. The changes take immediate effect and do not require a restart or an
iisreset call.
Understanding the API
This book will explain the API as deeply and broadly as space allows. However, even that will not be
enough. We’ll even point to the entry points within the official documentation on MSDN. That’s not
enough either. If you need to know how something works internally to understand how to use it (instead of reinventing the wheel), use a tool like Reflector—it is priceless. Reflector is a free download from Red Gate www.red-gate.com/products/reflector
There are some exceptions, but almost all major parts of SharePoint 2010 are written in .NET, and
you can peek into the code and learn the Microsoft internals.

Whatever your intention and whatever sort of code you’re about to write, the API is your partner.
Using the SharePoint controls and methods is the recommended approach. You can extend, customize,
reformat, configure, preset, and generally do whatever you want with the existing components. But
never reinvent something and write your own as long as you can find something comparable inside SharePoint. These components fit very well into the platform and they have many useful features.
Adopting and changing is almost always better than writing your own from scratch.
Only if you can’t find anything usable within SharePoint should you consider backing up a step and
trying an ASP.NET component. Imagine a table you wish to use to present some data. First, try the
SPGridView control. It’s feature rich, and end users know it because it’s the standard control used to
present lists. It has such features as sorting and grouping. It’s almost public, so you can easily hook into the interfaces and events and customize it. It’s there for you. Only after you’ve experimented with customizing the SPGridView control and found it inadequate for your purposes should you try its base class, GridView, from ASP.NET. It might be simpler, but you can add your own features more easily. If even this fails, use the .NET Framework and write your own grid.
Once you have adopted, customized, and modified a component, think about team productivity.
Repackage your component as another custom component, add configuration features, and make it
installable. Redistribute it in your team and encourage others to make use of it. That way you ensure that your colleagues struggling with the API do not stray from the recommended approach.

1 comment: