Development Server Configuration Share Point 2010

For development purposes, SharePoint 2010 can be installed on either a 64-bit Windows 7 or Windows Vista SP1 client machine or a 64-bit Windows 2008 or Windows 2008 R2 server. While writing this book, I used a Windows 2008 Virtual Machine running on VMware workstation. I used the following tools:

  • SharePoint Server 2010 Beta 2
  • Visual Studio 2010 Beta 2 & Release Candidate
  • Office 2010 Beta 2
  • Visio 2010 Beta 2
  • SharePoint Designer 2010 Beta 2
  • Red Gate .NET Reflector Pro
  • TypeMock Isolator

In Business Intelligence, I used a separate virtual machine with the same configuration and tools, except I used SQL Server 2008 R2 November CTP to enable use of PowerPivot.

Additional Development Environment Configuration

In addition to installing the software listed previously, you’ll need to take a few additional steps to follow the examples in this.

Defining an SPRoot Environment Variable

By performing a standard installation of SharePoint, most of the program files are installed at C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14. For many examples, you need to add or edit these files. Rather than continually referencing the full path, you can define an environment variable that can be used as a shortcut.

Take the following steps:

  1. Open a command prompt window.
  2. Enter the following command:

setx SPROOT "C:Program FilesMicrosoft SharedWeb Server Extensions14

NOTEThe omission of quotation marks at the end of the command line is intentional.

Using Office Applications in Windows 2008 Server
Because Windows Server 2008 is not deigned to be a client operating system, some of the integration features of products such as Word 2010 don’t work as you would expect. All Office 2010 applications come with a new backstage area that, among other things, allows users to publish documents easily to SharePoint document libraries. For this feature to work correctly on Windows 2008, the Desktop Experience feature must be enabled. To enable the Desktop Experience feature, take the following steps:

  1. Open the Server Manager application.
  2. Select the Features node, and then click the Add Features button link.
  3. In the Add Features Wizard dialog, select the Desktop Experience feature.

Debugging and Unit Testing SharePoint Applications

SharePoint 2010 is a 64-bit application. Therefore, all the code that we write that will run within SharePoint-managed processes must also be 64 bit. This detail can cause a bit of confusion, especially when you’re trying to debug console applications or run automated unit tests. To illustrate this point, suppose we have the following simple event receiver:

When running this test within Visual Studio, a System.IO.FileNotFound exception is thrown, suggesting that the web application could not be found. This error is misleading; if the site URL is correct, most likely the error is being thrown because we’re trying to use the SharePoint object model from within a 32-bit application. Although Visual Studio supports 64 bit code, by default many projects are created in 32-bit mode, particularly console applications, as you’ll see later. Also,the test runner within Visual Studio runs as a 32-bit application, meaning that unit tests cannot connect to SharePoint objects. Although you can force the test runner to use 64-bit, this uses a different test runner that runs as a .NET 4 application; as a consequence, SharePoint is not supported, since it is based on .NET 3.5. All is not lost, however; when creating unit tests, it’s generally considered good practice to isolate all dependencies, and with clever use of TypeMock, we can change our unit test as follows:

This time, the test passes as expected, because even though our code is being fully tested, since we’re using mocked SharePoint objects rather than real objects,the test runner can execute our test in 32-bit mode.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Share Point 2010 Topics