Long boring explanation. I have a unit test that searches for a particular pattern in the source code. If the pattern is found it breaks the build. This is not something that I can easily extract from the compiled assembly and I cannot guarantee that the build server is running the unit tests from the /bin/Debug folder so I need a way of tracking down where the source code was compiled from and then I can use that to determine the relative location of the solution folder. The code we originally had was automating the VS2010 IDE to find the solution folder but that doesn't work outside of Visual Studio.
It occurs to me that I could write this as a separate tool/powershell script and run it as a part of my build but the solution presented works well enough and fits into our existing test infrastructure. Michael M. Minutillo Indiscriminate Information Sponge http://codermike.com On Tue, Sep 13, 2011 at 8:13 AM, David Richards < [email protected]> wrote: > I'm surprised this hasn't been mentioned yet but I use: > > System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase > > or you can use GetCallingAssembly if that makes more sense. > > David > > "If we can hit that bullseye, the rest of the dominoes > will fall like a house of cards... checkmate!" > -Zapp Brannigan, Futurama >
