Partilhar via


Step 1: Set Up the Project for the Federated Search HTML to RSS Converter

Before you can use the sample, you need to create a new Web site and load the required object hierarchies. The tasks involved include:

  • Creating the Web Site project

  • Building the HtmlAgilityPack assembly.

  • Adding the required references

Creating the Web Site Project

The sample is designed to be built and deployed by using Visual Studio 2005.

To create the Web Site project

  1. In Visual Studio 2005, on the File menu, point to New, and then click Web Site.

  2. In Visual Studio installed templates, click ASP.NET Web Site.

  3. In Location, click File System, and, if necessary, click Browse to find the correct location for this Web site. This can be the standard location for your Visual Studio projects and Web sites or the location under your Web site's virtual directory where you will deploy this Web application.

    Note

    This sample is designed to be deployed on a different Web site. However, it might be more convenient and simpler architecturally to deploy it in the _layouts directory of a Microsoft Search Server site. For more information, see How to: Create a Web Application in a SharePoint Web Site and Getting Started with Customizing a SharePoint Web Site in Visual Studio. These instructions also apply for deploying it on any SharePoint Web site.

  4. In Language, click Visual C#, and then click OK.

Building the HtmlAgilityPack Assembly

The Federated Search HTML to RSS Converter uses the HtmlAgilityPack assembly, an HTML parser used to build structured XML documents from HTML documents and streams. This assembly is lightweight and easy to use, and it enables you to move through an HTML document by using XPath queries. However, you might choose to use another HTML parser for your scenario. You can also extract HTML by using regular expression mapping. If you use this approach, however, you do not need HtmlAgilityPack. See Regular Expression Examples for examples of code that extracts and manipulates text by using regular expressions.

If you choose to use the HtmlAgilityPack assembly, you must download and compile its source code so that you can add it as a reference to this solution.

To build the HtmlAgilityPack assembly

  1. From the Source Code tab of the HtmlAgilityPack site on CodePlex, download and unzip the latest version of the source code to the appropriate location in your file system.

  2. In Visual Studio 2005, on the File menu, point to Open, and then click Project/Solution.

  3. In Open Project, locate and open the HtmlAgilityPack.csproj file.

  4. On the Build menu, click Build Solution.

  5. Verify that the compiled component file (HtmlAgilityPack.dll) is built. By default it should build to the /bin/debug directory of your project. If you want to change this location, on the Project menu, click HtmlAgilityPack Properties. In HtmlAgilityPack, on the Build tab, change the value for Output path.

Adding the Required References

To load the object hierarchies that this sample uses, add references to the required components (including the HtmlAgilityPack assembly).

To add the required references

  1. On the Web Site menu, click Add Reference.

  2. On the .NET tab, select the following references, and then click OK after each selection:

    • System

    • System.Web

  3. On the Browse tab, locate the compiled component file (HtmlAgilityPack.dll) that you built. Select HtmlAgilityPack.dll, and then click OK.

Next Steps

Step 2: Add the Code for the Federated Search HTML to RSS Converter [Search Server 2008]

Step 3: Create the Federated Search Location and Customize the XSL [Search Server 2008]

See Also

Concepts

Federated Search HTML to RSS Connector Sample [Search Server 2008]