Developing and Deploying a SharePoint Feature - Part 2
page 3 of 7
by Steven Barden
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 27072/ 74

Preparing to continue

As you have seen from the construction of the solution in Part 1, some of the components will be added by you and copied into place, such as page objects. Yet others will be assemblies that you will copy into a bin directory or the GAC. This obviously implies that during these exercises we will be using basic copy processes to place our files in the proper location. SharePoint also allows you to distribute your files in CAB format. This means building your solution like we are doing here, then compiling the components into a CAB file that can be distributed in any number of ways, such as a download or a CD/DVD, along with a setup file. Finally, you may choose to use stsadm to deploy the final solution, for example at a client site. Due to various complexities in the act of building a CAB file in a SharePoint solution, I will cover this method in the future.

If you have not already downloaded the source code from Part 1 of this article series, you can find it by way of the first article at http://aspalliance.com/author.aspx?uId=45726. I am using Visual Studio 2008, but the topics I have covered so far should not be version specific between Visual Studio 2005 and 2008. You may also skip the first article code and download this code by way of the download links provided.

Enabling Intellisence for various SharePoint XML files…

SharePoint XML file Intellisence is not enabled by default. However, there are a few ways to correct this. The following actions will work for many types of SharePoint files, with the following steps specifically targeted at the Feature.xml file.

In short, our goal is to point the use of the Visual Studio IDE toward certain XML / XSD files on the file system, to enable the use of Intellisence. There are actually several different ways to do this, from more manual to more automated.

1) The more GUI operated way is to begin by opening an XML file, such as the feature.xml file. Once you have the feature.xml file open in Visual Studio, navigate to the properties window. Select "Schemas" and click the ellipsis on the right side of the box. Once the XML Schemas popup window is open, click the Add button, navigate to the "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML" directory (accounting for the install drive and location you used) and select the "wss.xsd" file. Click Ok and navigate back to the feature.xml file open in Visual Studio and you will now have Intellisence functionality. The options offered in the feature.xml file will seem fairly sparse, but there are not many options here. You will notice far more functionality when it comes to other XML files, such as those that the feature xml file may call (not seen in this project).

2) The second and arguably easier way (although less informative way) to accomplish this task is to directly add the path and file names of the desired XSD files that are found during step one. In other words, you perform step one once, and then use the settings over and over. The complete list of files that are recommended are:

"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML\CamlQuery.xsd"

"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML\camlview.xsd"

"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML\coredefinitions.xsd"

"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML\wss.xsd"

The lines above are the individual lines. In reality they are all run together, as seen below.

"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML\CamlQuery.xsd" "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML\camlview.xsd" "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML\coredefinitions.xsd" "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML\wss.xsd"

3) There is a third solution, which is more elegant, permanent, and global. I learned one in a Ted Pattison Group class (have I suggested you should review his information and courses?), but it has also been published by John Lee on blogs.msdn.com. As a side note, I highly suggest reviewing John's page as it has very valuable reading.

To accomplish the goal of permanently enabling this functionality, start by opening the following directory: "C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas." Then make a text file, and rename it "sharepoint_catalog" and change the extension to ".xml." Inside this file add the contents below: 

Listing 1

<SchemaCatalog xmlns="http://schemas.microsoft.com/xsd/catalog">
<Schema href="C:\Program Files\Common Files\Microsoft Shared\web server 
extensions\12\TEMPLATE\XML\wss.xsd" 
targetNamespace="http://schemas.microsoft.com/sharepoint/" /> 
</SchemaCatalog>

Now, simply close and re-open all instances of Visual Studio and you should be set, that is, each of the XML files you will work with should allow the use of Intellisence as needed. Now, with that said, I ran into a problem where this did not appear to work right. I reset Visual Studio and even rebooted the PC and it still did not seem to work. Then, sometime shortly after that, it started working and has not stopped working correctly. So my point is, do not be surprised if there is a problem at one point enabling Intellisence to find it seems to correct itself.


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2021 ASPAlliance.com  |  Page Processed at 2021-04-16 11:05:30 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search