Hi, I have an Access DB that I would like to extract the source code from so I can put it into Source control.
I have tried to extract the data using the Primary Interop Assemblies(PIA), but I am getting issues as it is not picking up all of the modules and forms.
There are 140 Forms and Modules in the code(Don't ask, it's a legacy system I have inherited) but the PIA code is only picking up 91 of them.
Here is the code I am using.
using System;
using Microsoft.Office.Interop.Access;
namespace GetAccesSourceFiles
{
class Program
{
static void Main(string[] args)
{
ApplicationClass appClass = new ApplicationClass();
try
{
appClass.OpenCurrentDatabase("C:\\svn\\projects\\db.mdb",false,"");
Console.WriteLine(appClass.Version);
Console.WriteLine(appClass.Modules.Count.ToString());
Console.WriteLine(appClass.Modules.Parent.ToString());
int NumOfLines = 0;
for (int i = 0; i < appClass.Modules.Count; i++)
{
Console.WriteLine(appClass.Modules[i].Name + " : " + appClass.Modules[i].CountOfLines);
NumOfLines += appClass.Modules[i].CountOfLines;
}
Console.WriteLine("Number of Lines : " + NumOfLines);
Console.ReadKey();
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + "\r\n" +ex.StackTrace);
}
finally
{
appClass.CloseCurrentDatabase();
appClass.Quit(AcQuitOption.acQuitSaveNone);
}
}
}
}
Any suggestions on what that code might be missing? or on a product/tool out there that will do this for me?
Edit: I should also mention that this needs to script to disk, integration with VSS is not an option as our source system is SVN. Thanks.