visual studio - What's an easy way to access prebuild macros such as $(SolutionDir) and $(DevEnvDir) from code in C#? -


Now I'm thinking that a file is written in a pre-build event and then read the code from that file, but I'm wondering what is an easy and beautiful way.

EDIT: This is a follow up follow-up, because I did not really get the answer, if I answered a simple question.

Here's a dirty hack: Dump them into a file.

  1. Add a task to the pre-build event to output the path to your solution in a file:

    $ echo (SolutionDir)> SolutionDirFile.txt

  2. Read the file SolutionDirFile.txt in your C # code.


Comments