Is there a way for a program to detect if it was called by MSBuild or not?
I'm looking in the environment but I can't 开发者_开发知识库see anything that I could use. Any ideas?
I'm trying to submit a patch for in Waf a bug that only appears when running the build under MSBuild (...yes I know, it sounds crazy but we're driving our Teamcity server using MSBuild).
Whilst I can't tell you exactly how to do it, I know you can do this.
You should look at functionality to find your parent process and then it's executable name to determine if it's MSBuild.exe or not.
Hope that helps to at least point you in the right direction.
Maybe this process itself can check if there is any MSBuild.exe instance running? That can be an easy hack, though it does not answer your question.
精彩评论