Transforming Discontinued FoxPro Technology to .NET 8 with Generative AI

Md Shofiul Islam
Brain Station 23 PLC.
6 min readJun 13, 2024

FoxPro, a combination of a database management system (DBMS) and a programming language, was a great tool back then in the software industry for managing data and building desktop applications. It was initially developed by Fox Software and later acquired by Microsoft in 1992. FoxPro had multiple updates over the years, each of which expanded its feature set and enhanced its capabilities to suit the expanding demands of its users. Despite all of its accomplishments, FoxPro gradually phased out in order to embrace more scalable, secure, and adaptable technology.

Why Transition to Dotnet?

Shifting from FoxPro to .NET becomes essential for upgrading applications to keep up with contemporary technological standards. FoxPro was discontinued by Microsoft in 2007, and no longer receives updates or support, leaving systems vulnerable to security risks and technological obsolescence. In addition to that, FoxPro’s architecture struggles with large-scale data handling and high user concurrency, making it unsuitable for modern enterprise needs. Furthermore, integrating FoxPro with newer technologies often requires costly and complex solutions.

On the other hand, .NET 8 presents a robust framework that supports cross-platform development, provides enhanced performance and scalability, and is supported by a strong community and continuous Microsoft support. It incorporates modern development practices such as asynchronous programming and microservices architecture, making it ideal for building secure and efficient web applications. Migrating to .NET 8 not only addresses the limitations of an outdated system but also aligns with strategic business goals by leveraging cutting-edge technology to foster innovation and competitive advantage.

Another major reason, people nowadays are more comfortable in web app over traditional desktop applications

Using AI for a Seamless Transition

Step 1: Finding the Legacy

This is undoubtedly the most crucial part of this project — finding an open-source project in FoxPro. Initially, I tried using Google to locate some existing projects, perhaps something like a To-do list or a similar small project that we could convert for this purpose. However, I only found plugins, not any real projects.

So, I tried a different approach: I asked ChatGPT to provide some GitHub repositories. ChatGPT gave me multiple repositories, but most of the links no longer worked, probably because the repositories had been deleted or were made private. After trying a few more times, I finally managed to find a project named TaskListManager.

Step 2: Analyzing Files

Since it’s a very old project and in FoxPro, I had no idea what each code or file did. So, I decided to give ChatGPT the names of all the files, along with their extensions, and asked it to classify the files based on their responsibility. Regretfully, there were 52 files in the project, and manually writing down the file names was a tedious task and the worst way to burn my time. So, I decided to use my Linux knowledge. Luckily, Git Bash inherits all the common Linux commands.

I navigated to my project folder and ran this simple Linux command in Git Bash, and this simple code did the job for me :ls ./* > fileNames.txt .This command generated a file named fileNames.txt containing the all of file names.

And then, I give the fileNames.txt to ChatGPT and asked to classify files based on their responsibility, with a nice summary. This summary was very helpful to understand the files’ importance for our web application.

FoxPro File types and description

Step 3: Exploring the project on Visual FoxPro

Now that I have a better understanding of the file structure, I know where to start. I was searching for a file with. PJX extension, because AI told me it’s Visual FoxPro file that open the project on Visual Project. Within few second I found a file named tasklist.PJX, when I clicked on it, it opens a little window on Visual FoxPro.

Visual FoxPro Window

There were multiple tabs, but where I was more interested in was code tab. Because it contained all the essential code files for the project.

Visual FoxPro Code Tab

Step 4: Customize ChatGPT

ChatGPT version: ChatGPT 4

First, I customized ChatGPT to fit my project using the customization feature. This made it easier to get the responses just the way I needed them.

ChatGPT Customization

In the Customize ChatGPT tab, I got access to three additional features: Custom Instruction, Answer Format, and ChatGPT Capabilities.

Customize ChatGPT window

In the Custom Instructions section, I told ChatGPT to specialize as an AI assistant for converting legacy FoxPro code into modern C# using .NET 8, focusing on handling database operations with Entity Framework and transforming UI code to web formats with HTML, Bootstrap, Data table, and jQuery. Transformation process starts with a detailed analysis of FoxPro scripts to capture crucial functionalities and UI elements. From there, it switches to write the business logic and data handling in C#, and generating desktop UI components to eye-catchy, responsive web interfaces. It was instructed to following .NET 8 best practices, such as implementing asynchronous patterns and organizing the codebase into a clean MVC architecture to boost both maintainability and clarity.

In the Response section, I gave instructions about how I expect the result for both frontend and backend components. For the frontend, the structure begins with either a <section> or <div> in index.html, along with CSS and jQuery for styling and functionality. For the backend, the instruction was starting with DBModel,then a Service Interface and its implementation, and a Controller to link everything together seamlessly.

Expected Response format:

In GPT-4 Capabilities, I disabled all the capabilities except code. Although it doesn’t have much impact in the response, however, I want the ChatGPT to only focus on generating code.

Results:

FoxPro app:

A user can add task name along with a file name and due date. After entering the Task-1 it will create a task and add it in the list. User can set the priority of the task: Low, Medium, and High, and after finishing the task user can mark it as complete.

FoxPro application

Output of Dotnet web app:

Dotnet web application

Challenges:

Since I converted a desktop application to web application, I didn’t get the full HTML code in one go. After getting the top level design from ChatGPT, I had to ask for the some of the specific functionalities like add this or that fields in the table, or if the user check the complete button line-through the entire row and implement the backend service for that. This was the problem I faced mostly.

Conclusion:

Utilizing generative AI, I was able to quickly understand and classify the legacy codebase, transforming it into an impressive web application framework with modern features. The AI’s ability to analyze and categorize information accelerated the project’s early stages, allowing us to focus on strategic development rather than dull work. The final result was a significant reduction in development time, from months to a few days.

Here is the detailed breakdown of time spent on this project:

Time Spent on Conversion of FoxPro to Dotnet 8

The successful completion of this project will serve as an inspiration for others, it’s showcasing that with the correct tools and techniques, the transition to current technologies can be easy and highly worthwhile.

--

--