1

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.

pinebitter
  • 100
  • 11

1 Answers1

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();
Community
  • 1
  • 1
Geddon
  • 1,266
  • 1
  • 11
  • 31