How do you get the current project directory from C# code when creating a custom MSBuild task?

Instead of running an external program with its path hardcoded, I would like to get the current Project Dir. I’m calling an external program using a process in the custom task.

How would I do that? AppDomain.CurrentDomain.BaseDirectory just gives me the location of VS 2008.

26 Answers
26

Leave a Comment