Looks like all NAnt classes are internal and there's no a public managed API exposed from NAnt. Is there a way I can call NAnt from C# program with a custom script and parameters? Is there any 3rd party wrappers available somewhere? For now I'm considering two options: spawning a process and modifying NAnt manifest to add InternalsVisibleTo.
Asked
Active
Viewed 155 times
1 Answers
0
Referencing this. You can do the following.
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "NAnt.exe";
startInfo.Arguments = "-buildfile:NantScript.build";
process.StartInfo = startInfo;
process.Start();