AFAIK, there's no BCL API that will give you the path to a .csproj file. You should recall that a .csproj file is an artifact of Visual Studio, but .NET in itself doesn't rely on VS - you can compile C# applications using csc.exe, in which case you would have a fully functional .NET application without any .csproj file ever being involved.
If you want to test whether the application is running in debug mode, you can use the #if directive, like this:
bool debugging = false;
#if DEBUG
    debugging = true;
#endif
The debugging variable will only be true when the DEBUG symbol is defined, which it is when you compile in the Debug configuration. In a Release build, debugging would always be false.
However, I would consider it dubious to have such a requirement in the first place.