volody
volody

Reputation: 7189

how to convert vb6 to vb.net programmatically

Visual Studio comes with Wizard that converts vb6 code to vb.net. Is there are any way to call this conversion via code?

Upvotes: 1

Views: 1507

Answers (3)

volody
volody

Reputation: 7189

"Pretty listing (reformatting) of code" could be accomplished by next code based on How to: Fix 'Application is Busy' and 'Call was Rejected By Callee' Errors

// =====================================
// ==Insert your automation code here.==
// =====================================
Command cmd = dte.Commands.Item("Edit.Paste", -1);
object dummy = new object();
foreach (var item in Directory.EnumerateFiles(codefolder))
{
    dte.ItemOperations.OpenFile(PathToEmptyVbFile);
    Clipboard.SetText(System.IO.File.ReadAllText(item));
    System.Threading.Thread.Sleep(500); // to enable vs paste button
    dte.Commands.Raise(cmd.Guid, cmd.ID, ref dummy, ref dummy);
    dte.ActiveDocument.Save(item);
    dte.ActiveDocument.Close();
}

Upvotes: 0

Stephen
Stephen

Reputation: 3084

To be honest, when updating from VB6 to .NET it is much better to do it manually, this way you can improve the solution and not rely on 3rd party tools that may not convert the way you want to.

Upvotes: 3

JaredPar
JaredPar

Reputation: 754545

No this not accessible from code. This process is largely driven by a command line tool and doesn't have a public facing API (that I'm aware of at least).

Can you help us understand how you plan on using this?

Upvotes: 2

Related Questions