Visual FoxPro Data Client missing from data source

Feb 1, 2013 at 5:16 PM
I'm not entirely sure when this stopped working, but I just downloaded and installed the latest provider and ran the install. When I go to Add > ADO.NET Entity Data Model > New Connection > Change, I'm not seeing the Visual FoxPro Data Client in the list. I also tried selecting "<other>" and picking from the combo like in the previous versions, but the provider isn't listed there either.

I am running VS 2012, so I created a new project to test this - again, it was missing. I fired up VS 2010 and tried adding it. Instead of the provider just missing, the form to add a new item immediately closed (it didn't even give me the opportunity to pick something; as soon as I click Change the form appears briefly, then it and the add model form closes).

Strangely, I have a VS 2012 project that is using this provider and it works OK. I just can't create a new model now.

If it matters, this is under Win 7 x64.
Feb 1, 2013 at 6:50 PM
In researching this issue I found that the installer would intermittently fail to add the registry keys needed for Visual Studio to recognize the VFP Client Provider. Unfortunately, I’m unable to determine the reason for the failure because it doesn’t get logged which is why I guess the installer “installs successfully” when truly it hasn’t. I’ll have to do some more digging around to see if I can find the source of the problem. In the meantime, you should be able to uninstall/reinstall to get it to work.

Additional Info:
You can verify the registry part of the install worked by check to see if the following key exists.
Feb 1, 2013 at 8:04 PM
I uninstalled it and re-ran the install (I "unblocked" the download, thinking that may have been the source of the problem). Now it fails part of the way through and rolls back. However, if I run it via the command line (open cmd.exe as an Administrator), it completes but doesn't write the registry key. I ran the install and logged it, and it is failing here:
MSI (s) (00:90) [15:56:02:325]: Invoking remote custom action. DLL: C:\Windows\Installer\MSID4B0.tmp, Entrypoint: Install
MSI (s) (00:B4) [15:56:02:326]: Generating random cookie.
MSI (s) (00:B4) [15:56:02:327]: Created Custom Action Server with PID 9736 (0x2608).
MSI (s) (00:CC) [15:56:02:360]: Running as a service.
MSI (s) (00:CC) [15:56:02:362]: Hello, I'm your 32bit Impersonated custom action server.
SFXCA: Extracting custom action to temporary directory: C:\Users\PCMROZ~1\AppData\Local\Temp\MSID4B0.tmp-\
SFXCA: Binding to CLR version v4.0.30319
Calling custom action VfpEntityFrameworkProvider.CustomAction!VfpEntityFrameworkProvider.CustomAction.MachineConfigUpdater.Install
System.UnauthorizedAccessException: Access to the path 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at System.Xml.XmlDocument.Save(String filename)
   at VfpEntityFrameworkProvider.CustomAction.MachineConfigUpdater.<Install>b__0(XmlDocument xmlDocument, XmlNode factoriesNode, String configFile)
   at VfpEntityFrameworkProvider.CustomAction.MachineConfigUpdater.Execute(Session session, Action`3 action)
CustomAction CA_AddMachineConfigEntry returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 15:56:03: CA_AddMachineConfigEntry. Return value 3.
MSI (s) (00:34) [15:56:03:053]: Machine policy value 'DisableRollback' is 0
MSI (s) (00:34) [15:56:03:053]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 
MSI (s) (00:34) [15:56:03:057]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 
MSI (s) (00:34) [15:56:03:058]: Calling SRSetRestorePoint API. dwRestorePtType: 13, dwEventType: 103, llSequenceNumber: 1562, szDescription: "".
MSI (s) (00:34) [15:56:03:058]: The call to SRSetRestorePoint API succeeded. Returned status: 0.
MSI (s) (00:34) [15:56:03:058]: Unlocking Server
Action ended 15:56:03: INSTALL. Return value 3.
So apparently, even though it prompts me for the admin account to elevate privileges, it still fails. I checked the permissions on machine.config for an Administrator and it has Full Control/R/W/Modify/Execute permissions set.
Feb 1, 2013 at 8:39 PM
So the problem is with writing to the machine.config...

Could you verify that the logged in user has access to machine.config? (file properties->Security->Advanced->Effective Access)
Is the machine.config "read-only?"
Feb 4, 2013 at 12:34 PM
Yes, both the logged on user and the Administrator have write access to the file. No, the file isn't read-only. The strange thing is if I run it from a "Admin" command line, it completes w/o any errors, although the registry keys aren't written.
Feb 4, 2013 at 1:03 PM
Just a follow up. I tried installing this on one of my other machines (also Win 7 x64) and it fails the same way.
Feb 4, 2013 at 1:35 PM
Edited Feb 4, 2013 at 1:35 PM
I’m not sure why the installer isn’t working correctly for you. I’ll have to setup a virtual machine to see if I can reproduce your issue. Are you using Visual Studio 2010 and/or Visual Studio 2012?

If you want to manually setup the VFP EF Provider:
  • You can use these registry settings
  • Add the following in the C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config - DbProviderFactories element.
<add name="Vfp Entity Framework Provider" 
      description="Vfp Entity Framework Provider" 
      type="VfpEntityFrameworkProvider.VfpProviderFactory, VfpEntityFrameworkProvider, Version=, Culture=neutral, PublicKeyToken=feace53afe38fe48" />
Feb 4, 2013 at 2:14 PM
I have both VS 2010 and VS 2012 installed on these machines.
Feb 6, 2013 at 12:41 AM
Testing with a fresh install of Windows 7 I found that the installer fails when executing the MSI with the User Account Control is on. However, it would work fine when installing from and Admin-Command Prompt with UAC still on. If I turn off UAC the installer worked as expected (which is how my machines are setup). From what I can tell, the only way to get the installer to work as expected with UAC on is by signing the MSI file. But to be honest, I’m not interesting in purchasing a certificate for the installer at this point. What I’m thinking about doing is modifying the installer to display a message stating that the machine.config couldn’t be updated and in that message include the details on how to manually update the machine.config. Do you think this would be an acceptable solution?