If you read the contents of the Readme.txt that comes with Sedna, you would think that the DDEX Provider can be registered for Visual Studio 2005 by simply shelling out to the command prompt and running the included RegDDEX.exe. Unfortunately, following the outlined steps to the letter will result in very little. In short, the “Microsoft FoxPro Database File (FoxClient)” will not show up in the list when attempting to add a connection from the Server Explorer or when adding a new using the Add New Data Source from the Data menu provided in Visual Studio. Another frustration that many are bound to run into is that the RegDDEX.exe will not even run if you don’t have Visual Studio 2005 installed… I don’t know about you, but I’m using Visual Studio 2008.
Some Directions That Will Work
We have the source code for RegDDEX.exe and a few quick searches on MSDN will provide a wealth of information on how to install a DDEX Provider. So, what’s wrong with what we were given? Well, first off when installing Sedna’s DDEX Provider the RegDDEX.exe is responsible for a few basic tasks.
- Verify that it can find the Fox Client (Microsoft.Data.FoxClient.dll)
- Verify that Visual Studio 2005 is installed (more on this in a moment)
- Modify the machine.config file (located in C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG)
- Copy Microsoft.Data.FoxClient.dll to the installdir for Visual Studio (such as C:\Program Files\Microsoft Visual Studio 8.0\Common7\IDE)
Near the bottom of the machine.config file you will find a DbProviderFactories node that has a bunch of <add> elements underneath it. The RegDDEX.exe simply adds another element to this list. The element that it adds looks like the following:
<add name=“FoxPro Data Provider” invariant=“Microsoft.Data.FoxClient” description=“.Net Framework Data Provider for FoxPro” type=“Microsoft.Data.FoxClient.FoxClientFactory, Microsoft.Data.FoxClient, Version=220.127.116.11, Culture=neutral, PublicKeyToken=c45cdbf5d603d993” />
What to Change for Visual Studio 2008
If you are using Visual Studio 2008 then you will need to either do the preceding steps manually or modify the RegDDEX project and recompile it. To do the following steps manually, you would copy the Microsoft.Data.FoxClient.dll to C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE and then add the preceding element to the machine.config file. If you wish to modify the RegDDEX as I did, then go to the source (C:\Program Files\Microsoft Visual FoxPro 9\Sedna\DDEXProvider\Source) and open up the project in Visual Studio. Open the MainModule.vb and modify line 44 to read…
Console.WriteLine(” Unable to detect Microsoft Visual Studio 2008.”)
… and modify line 76 to read…
key = My.Computer.Registry.LocalMachine.OpenSubKey(“SOFTWARE\Microsoft\VisualStudio\9.0”)
Then, recompile the RedDDEX (I renamed mine to RegDDEXVS2008.exe) and run it
After Running RegDDEX
As previously stated, after running RegDDEX the DDEX provider still doesn’t show up in the list. Well, the problem is that the Registry still doesn’t have all the information it needs. Luckily, this is pretty easy to remedy. In the provided source for Sedna’s DDEX Provider there is a file named microsoft.data.foxclient.design.reg. This file is located in the C:\Program Files\Microsoft Visual FoxPro 9\Sedna\DDEXProvider\Source\Microsoft.Data.FoxClient.Design folder. Now, don’t run that reg file as-is because there are some problems with it. You’ll need to first open it up and note that near the bottom of the file are a bunch of paths that appear to have come from Milind’s development machine. You probably don’t have Visual FoxPro installed on your D:\ drive and Sedna’s install certainly doesn’t install the DDEX Provider component’s into the VFP 9.0 install directory anyways. So, to fix this registry file you will want to modify the last two entries in it so they read as follows…
“CodeBase”=“C:\\Program Files\\Microsoft Visual FoxPro 9\\Sedna\\DDEXProvider\\Microsoft.Data.FoxClient.Design.dll”
“Path”=“C:\\Program Files\\Microsoft Visual FoxPro 9\\Sedna\\DDEXProvider”
What to Change for Visual Studio 2008
Those of you running Visual Studio will need to perform the above step and the additional step of searching and replacing all occurrences of “VisualStudio\8.0” with “VisualStudio\9.0”.
Add the Information to Registry
Once you’ve completed the above steps, regardless of your version of Visual Studio) you will then need to run the microsoft.data.foxclient.design.reg file to add the information to your registry.
Whew – All Done!
If you’ve followed the steps as outlined here, you should now be able to open up your copy of Visual Studio and add a connection to a Visual FoxPro database. There are lots of cool features provided by Visual Studio’s Server Explorer and using the DDEX Provider that is provided with Sedna makes working with VFP data sources a joy. I’m a little disappointed in the RegDDEX and the lack of documentation provided to VFP developers trying to install the DDEX Provider, but it gave me an opportunity to post a cool blog entry and when I get a chance I’ll fix this all up by modifying the DDEX Provider project provided out on VFPX. That’s one of the things I love about VFP… the VFP Community can provide for themselves.
Until next time… VFP Rocks!