Configuring Visual Studio .NET

Web Connection will automatically configure itself for operation with Visual Studio if you use the Web Connection installation and create new projects with the new project Wizard. The wizards will ensure that the default templates and the Add-in get installed properly as well as configuring your Web.Config file for you.

To run this, please use the following code from your Web Connection install directory:

DO CONSOLE WITH "VSNETCONFIG"

or use the Web Connection Menu and Configure Visual Studio.

This utility configures all of the configuration settings required. However, depending on your Visual Studio configuration it's possible that some settings may not be set up completely. The most common problem is that the Web Connection controls fail to register properly on the Visual Studio Toolbox and you may have to add them manually as described below.

Manual Visual Studio Configuration

This topic describes the complete process for manual configuration as well as a couple of the steps that cannot be automated. The following are covered:

Copy WebConnectionWebControls.dll into the bin directory


occurs by default when you create a new project
In order for Visual Studio to be able to see Web Connection specific controls you need to copy the wwWebControls.dll file into the BIN directory of your Web application. This is a file that won't be used by your application, but Visual Studio needs in order to display the Web Connection controls on the toolbox and in the designer with all the custom Web Connection control properties.

Add WebConnectWebControls.dll to the VS.NET Toolbox


one time manual configuration
In order to use the Web Connection Controls and to visually drop them onto Web forms you'll want to register the controls. To do this in Visual Studio:

Enable support for WCSX or custom Extensions


Each extension must be manually configured once in Visual Studio so Visual Studio recognizes these extensions as Web Forms.

Custom ScriptMap Extensions:
You can use any scriptmap extension for your script classes. Web Control framework pages can automatically be accessed if a page does not exist in your wwProcess subclass. For simplicity I'm going to use WCSX here, which is the default scriptmapped engine supported by Web Connection, but you can map any process class to a scriptmap and then use this same process for that script extension.

  1. In VS.NET 2005 under Tools | Options | Text Editor Extensions add WCSX (or your Process Class' scriptmap - .dp shown here) as Web Form Editor

    Extended Options:
    Make sure that when you go to Tools | Options you always check the Show all settings checkbox. Some options like the extension mapping become available only after enabling this flag. This is especially true for Visual Web Developer.

  2. Add a Web.config to the root of your Web directory
    Then add the following to have VS.NET recognize your specific application extensions:

    <configuration> <system.web> <compilation defaultLanguage="c#" debug="true"> <buildProviders> <add extension=".dp" type="System.Web.Compilation.PageBuildProvider" /> <add extension=".blog" type="System.Web.Compilation.PageBuildProvider" /> <add extension=".wcsx" type="System.Web.Compilation.PageBuildProvider" /> </buildProviders> </compilation> </system.web> </configuration>

    This adds the necessary namespace recognition and ensures that syntax color highlighting and intellisense work properly against ASP.NET controls.

    Note that the New Project and Process Wizards in Web Connection automatically add WCSX and the custom scriptmap configured for your process into the provided web.config file so this step is optional. If you decide later to add additional script maps or change an existing map in your application these maps have to be manually configured by both adding the editor association and the web.config BuildProvider setting.

Adding Web Connection Page and User Control Templates


Web Connection also ships with a set of templates that are available for C# Web Pages and templates. These templates provide a blank page layout for you with the wwWebPage control already placed in the page so you don't have to drop it manually.

You can copy these templates in an automated way by doing:

DO CONSOLE WITH "VSNET2005CONFIG"

inside of your Web Connection install directory or by running the Configure VS.NET 2005 option from the Web Connection Menu.

These files are installed for you automatically when you create a new Web Connection project, but if you need to manually copy the files you can move:

<wconnect_InstallDir>\VisualStudio\Web Connection Page.zip
<wconnect_InstallDir>\VisualStudio\Web Connection User Control.zip

to:

<My Documnents Dir>\Visual Studio 2005\Templates\ItemTemplates\Visual Web Developer

Once these templates have been moved they will show up on the Add New Item option in Visual Studio. Important: Make sure you are using C# as your language.

Adding the Web Connection FoxPro Source View Add-In


The Web Connection Source View Add-in attaches to the Tools menu in Visual Studio and allows you to directly jump to the FoxPro CodeBehind behind page from within Visual Studio if you are editing a Web Connection Web Control page. The page must contain the <%@Register> tag for the Westwind.WebConnection.Controls library in order for the addin to be available.

Visual Web Developer Note:
This feature does not work with Visual Web Develop as it doesn't support Add-ins as Visual Studio does. With VWD you have to manually open the codebehind file from Visual FoxPro.

As the Page Templates CONSOLE and Web Conection menu can automatically install the Add-in for you with:

DO CONSOLE WITH "VSNET2005CONFIG"

To manually install the Add-in, you can copy the WebConnectionAddin.Addin file from the <wconnectInstall>\VisualStudio directory into:

<My Documents>\Visual Studio 2005\Addins

Open the file and change the path in the <Assembly></Assembly> key to the path of the Addin dll. which is:

<wconnectInstall>\VisualStudio\VsNet2005Addin\WebConnectionAddin.dll

If you're using a locale other than US, copy the en-us directory to your locale specifier (ie. de-DE, de-AU, fr-CA etc.)

Configure the FoxPro Base Path for the Add-in


In order for the Add-in to find the FoxPro source file it needs to know the base path of the FoxPro application, so it can properly find the file and open it. The Source File contains a relative path to the current FoxPro IDE instance and so this path needs to be stored somewhere. The AppSettings section in the web.config file should have a section like this:

<appSettings> <add key="FoxProjectBasePath" value="c:\wwapps\wc3\"/> <add key="WebProjectBasePath" value="c:\westwind\wconnect\weblog\" /> <add key="WebProjectVirtual" value="http://localhost/wconnect/weblog/" /> <add key="IdeOnLoadPrg" value="" /> <add key="WebBrowser" value="" /> <add key="WebBrowserAlternate" value="" /> <add key="FoxProEditor" value=""/> <add key="FoxProEditorAlternate" value="C:\Program Files\TextPad 5\textpad.exe"/> </appSettings>

The Add-in reads the FoxProBasePath key out of the web.config file and then uses this path plus the project relativve path of the page to open the appropriate FoxPro source file.

Along the same lines the WebProjectBasePath entries are used to find the Web directory and then is used to launch the browser in this directory. This is the directory and virtual name of the directory where your Web files (.wcsx or your scriptmap) live.

The paths are automatically set when you create a new project with the new project Wizard. Make sure that you adjust these values if you move your project or otherwise change paths.

For more detail on Add-in configuration and the values you can set in the configuration see the Visual Studio Add-in Configuration topic.

A complete Web.config file


For completeness sake, here's a complete Web.config for a Web Connection project. You can use this for reference.

<?xml version="1.0"?> <configuration> <system.web> <compilation defaultLanguage="c#" debug="true"> <buildProviders> <!-- Add any script map extensions for your Web Connection pages here. Required by VS --> <add extension=".blog" type="System.Web.Compilation.PageBuildProvider"/> <add extension=".wcsx" type="System.Web.Compilation.PageBuildProvider"/> </buildProviders> </compilation> </system.web> <appSettings> <!-- Your FoxPro project path where you're working from. Acts as relative base path for PRG files --> <add key="FoxProjectBasePath" value="d:\wwapps\wc3\"/> <!-- The path of your Web files for this project. Acts as relative base path for Web templates. --> <add key="WebProjectBasePath" value="c:\westwind\wconnect\weblog\" /> <!-- The Web Server path to get to your base Web directory for the application. Used for preview your pages --> <add key="WebProjectVirtual" value="http://localhost/wconnect/weblog/" /> <!-- The default browser used. Blank IE Automation, otherwise specify browser path --> <add key="WebBrowser" value="" /> <add key="WbBrowserAlternate" value="c:\program files\firefox\firefox.exe" /> <!-- Specify an alternate non-VFP editor. Blank uses VFP Editor in IDE --> <add key="FoxProEditor" value="" /> <!-- Alternate FoxPro editor used with Show FoxPro Code. --> <add key="FoxProEditorAlternate" value="c:\programs\EditPadPro6\EditPadpro.exe" /> <!-- Optional PRG file launched when VFP IDE starts. Use for optional environment config --> <add key="IdeOnLoadPrg" value="" /> </appSettings> </configuration>

The key elements are:




  Last Updated: 5/27/2008 | © West Wind Technologies, 2008