tags:

views:

496

answers:

3

Has anyone had experience of or got any knowledge about the VFP to .Net Compiler?

I'm working for a company with an extensive range of VFP9 applications and they are looking for a quick way to get apps running in .Net. I've been asked to check out this compiler to see if it is a viable option but so far I haven't been able to get it to successfully compile anything - even my "Hello World" world application doesn't run.

Just to qualify that last remark: I can get really simple Fox apps to "compile" but the .Net executable that is produced does not execute successfully. I've dissassembled the source and turned it into C# but generally it contains many errors (100+).

I'm tempted to dismiss the whole technology out of hand however there seems to be lots of support for this and excitement about it the Fox user community. Does anyone have any insight into this?

Here is a link to the VFP to .Net Compiler

A: 

VFP doesn't directly "compile" to a .Net product. However, you can get to it via COM and creating a project as a single or multi-threaded DLL.

define class MyVFPForDotNet as custom OLEPUBLIC
  cSomeProperty = ""
  nOtherProperty = ""

  Function Init()
     cSomeProperty = curdir()

  endfunc

  Function SendBackAMessage()
     return "Hello World"
  endfunc

  function CallWithParms( cParm1 as String, nParm2 as Integer, dSomeDate as DateTime )
     .. do whatever

     return "whatever"
  endfunc

enddefine

Then you can add it as a COM Interop and the methods and properties would be available in .Net. Your functions can do almost anything in VFP, query, automation, etc. And you can simply do XMLAdapter to generate XML Strings to return back single or multiple cursor sets as one big chunk, or individually via multiple calls to different methods.

Good luck.

BTW... there are two upcoming seminars being offered for VFP developers who are looking into converting / accessing via .net. One at http://www.oakleafsd.com/, another at http://www.eps-software.com/

DRapp
The product in the link above claims to do just that: it takes a VFP application and "compiles" it into a .Net application. What comes out the other side is .Net exe which does the same as your VFP application. That's the claim anyway! Check the link: http://etecnologia.net/products/vfpcompiler/VFPCompiler-index.htm
Steve
There are actually two VFP to .NET compilers out there. They are not officially endorsed by Microsoft from what I'm aware of but there is the eTechnologia one and also one over at Foxite.
jpierson
+4  A: 

I now have some experience with the VFP to .Net Compiler which you can find here.

This is actually a compiler for .Net and has nothing to do with COM Interop or Web Services. The whole thing is built around SharpDevelop which ships with the compiler. Effectively you can fire up SharpDevelop and type in a FoxPro PRG. There is full in intellisense and most if not all Fox commands and functions are supported. When you hit compile, what comes out the other side is a full .Net assembly.

If you run the assembly there is no instance of VFP and no COM interop in sight. How does it work? The guys behind it have created .Net functions which map onto the Fox functions, so for example if you call the StrToFile() this is the code that actually runs (brought to you by the wonders of Reflector):

public static void StrToFile(string cExpression, string cFileName)
{
    if (File.Exists(cFileName))
    {
        File.Delete(cFileName);
    }
    FileStream stream = new FileStream(cFileName, FileMode.CreateNew, FileAccess.ReadWrite);
    StreamWriter writer = new StreamWriter(stream);
    writer.Write(cExpression);
    writer.Flush();
    writer.Close();
    stream.Close();
}

What this means is that if you are very productive in Fox but you a need .Net solution you can code in Fox and produce a .Net assembly.

I would however advise some caution as not everything is implemented as nicely as the StrToFile example above. The way it models things like Fox forms is pretty awful, although it does work (you can take an existing Fox form and add it to SharpDevelop and it will turn it in to a .Net form). If anyone wants any more detail I'll be happy to expand on this.

Steve
A: 

Some additional information on forms in the VFP Developer Studio for .Net: eTecnologia has announced that forms designed as VFP forms in SharpDevelop will optionally compile to SVG, which can run on every browser except IE, although there is a Google plug-in for IE that converts the SVG to SWF. They have also previously committed to outputting XAML for VFP forms designed in SharpDevelop. In addition, .Net controls, COM controls, and we are told Java controls, will all be able to be used on VFP forms designed in the customized #D that ships with the Developer Studio.

Hank Fay