Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Right now I'm thinking write the paths to a file in the pre-build event and then read from that file in the code, but I'm wondering if there's an easier more elegant way.

edit: This is sort of a follow up to Help with one step build all projects + installer (.NET + WiX) since I didn't really get an answer to that, seeing if I can get an answer to a simpler question.

like image 410
Davy8 Avatar asked Mar 01 '23 01:03

Davy8


1 Answers

Here's a dirty hack: dump them to a file.

  1. Add an action to the pre-build events to output your solution's path to a file:

    echo $(SolutionDir) > SolutionDirFile.txt

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

like image 194
Shalom Craimer Avatar answered Apr 08 '23 15:04

Shalom Craimer