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 173 times
1
-
Not sure what your requirement is, but I think using Process.Start could yield a result you want. – Nikhil Gupta Mar 23 '14 at 08:39
-
your best bet might be calling your Nant script via a command line call within your C# program. – Geddon Mar 27 '14 at 20:07
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();