开发者

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?


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.


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?


"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();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜