Section 8.1. Preparing to Develop


8.1. Preparing to Develop

Developing a web part requires access to the SharePoint DLL, which runs only on Windows 2003. Therefore, you must be running Windows 2003 to do development. There are a couple ways to do this on your development machine:

  • Upgrade to Windows 2003.

  • Use Remote Desktop to access a server running Windows 2003 and do your development there.

  • Use Microsoft Virtual PC to run Windows 2003 within Windows XP on your desktop.

The main advantages and disadvantages of each approach are summarized in Table 8-1.

Table 8-1. Possible web part development approaches

Approach

Advantage

Disadvantage

Upgrade

Best performance for development.

Changing your desktop OS is disruptive.

Remote Desktop

Server can be shared with other developers/testers.

Requires an additional physical server.

Virtual PC

Contained on single desktop, you can create/change server configurations without affecting others.

Performance is reduced.


Whichever approach you use, there are a few cautions to keep in mind. Don't develop on a production server. Doing development requires temporarily changing security settings that might open avenues for attack and running untested web parts (or any component) on an in-service server is never a good idea. Software requirements and licensing issues are the same for physical or virtual PCs.

The following sections explain how to use these different approaches and how to configure the server for development.

8.1.1. Using Remote Desktop

To use Remote Desktop to access a development server you must have an account on that server and the server must have remote access enabled. To enable Remote Desktop access to the server:

  1. From the server, choose Control Panel System Remote.

  2. Add your user account and the accounts of other developers that will have access. Choose OK twice to close the dialogs.

Then, to run Remote Desktop from Windows XP Professional:

  1. From the Start menu, choose All Programs Accessories Communications Remote Desktop Connection.

    1. Install Virtual PC on your Windows XP Professional desktop.

    2. In Virtual PC, choose File New Virtual Machine Wizard. The wizard walks you through the creation process. For web part development you will want to allocate at least 512 MB of RAM for the virtual machine.

    3. Configure Windows 2003 as an Application Server. Select Enable ASP.NET, but don't select FrontPage 2002 Server Extensions since they aren't compatible with SharePoint.

    4. Install Windows SharePoint Services from http://www.microsoft.com/downloads. The download file name is STSV2.EXE . For development purposes it is usually best to select the Typical Installation (WMSDE) option rather than Server Farm (SQL Server).

    The Virtual PC window captures your keyboard and mouse movements while it has focus. Virtual PC uses the right-hand Alt key as host key to release control and switch back to the host operating system. Table 8-2 lists some useful key combinations for Virtual PC.

    Table 8-2. Virtual PC key combinations

    Key

    Use to

    Host key (right Alt key)

    Release virtual machine's control of mouse pointer and keyboard. (Use to move mouse out of Virtual PC window and back to desktop.)

    Host key+Delete

    Send Alt+Ctrl+Delete to virtual machine.

    Host+Enter

    Switch between full-screen and windowed display.

    Host key+P

    Pause/resume virtual machine.

    Host key+R

    Reset virtual machine.

    Host key+F4

    Close virtual machine.

    Host key+down arrow

    Minimize virtual machine.


    8.1.3. Configuring the Server for Development

    Regardless of how you run Windows 2003, you must install the development tools within that Windows 2003 server and change some settings before you can develop web parts.

    To install the development tools and configure the server:

    1. Install Visual Studio .NET 2003. You can create web parts using Visual Basic .NET or Visual C#.

    2. Install the Web Part Templates from http://www.microsoft.com/downloads. The download file name is WebPartTemplatesforVSNetSample2.exe .

    3. Optionally, install FrontPage 2003. FrontPage makes it easier to create and modify test web part pages in SharePoint. You cannot edit SharePoint sites from Visual Studio 2003.

    4. In Windows Explorer, create a root folder, such as C:\WebParts , for your web part projects. Creating this folder makes it easier to use required command-line tools.

    5. Copy vsvars32.bat from C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools to C:\WebParts . You'll use vsvars32.bat to access the command-line tools.

    6. Add a \bin folder to the C:\InetPub\ wwwroot folder. That is the location where you will write web part DLLs during development.

    7. Open the Web.config file from C:\InetPub\wwwroot and change the trust level and debug settings as shown in this snippet:

       <configuration>         ...      <system.web>         ...        <compilation batch="false" debug="  true  " />       <trust level="  WSS_Medium  " originUrl="" />      </system.web>     </configuration> 

    The web part templates are written to work with Visual Studio .NET 2003. They do not work with earlier or beta versions of Visual Studio.


    While you have Web.config open, take a look at the SafeControls settings as well. You'll need to add a SafeControl element for each new web part project you create later on.



Essential SharePoint
Essential SharePoint 2007: A Practical Guide for Users, Administrators and Developers
ISBN: 0596514077
EAN: 2147483647
Year: 2005
Pages: 153
Authors: Jeff Webb

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net