Visual Studio comes with Wizard that converts vb6 code to vb.net. Is there are any way to call this conversion via code?
+2
A:
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?
JaredPar
2010-10-15 05:09:35
To make migration smooth, will be required to support both applications. Currently what I am doing is manual copy and paste portion of a code from vb6 into vb.net using Visual Studio. That allows to make initial code conversion properly. I would like to automate this process.
volody
2010-10-15 14:11:24
The only feature I need is "Pretty listing (reformatting) of code"
volody
2010-10-16 04:57:55
+1
A:
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.
kyndigs
2010-10-15 14:14:11
Gotta agree with kyndigs here. You're going to be missing out on tons of refactoring opportunities and ways to leverage .net if you attempt an automated conversion. In the end, automating may get you a result faster, but it'll cost you in the long run.
drventure
2010-10-15 16:54:46
A:
"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();
}
volody
2010-10-17 17:20:39