开发者

How to determine if a build is from the editor or command line?

开发者 https://www.devze.com 2023-01-15 05:30 出处:网络
I am building a C++ solution with Visual Studio 2005. Sometimes I open the solution in Visual Studio and build it from within the development environment.Other times I build it from the command line

I am building a C++ solution with Visual Studio 2005.

Sometimes I open the solution in Visual Studio and build it from within the development environment. Other times I build it from the command line using msbuild.exe. I'm wondering if there is a way that I can determine which of these two types of builds I'm using at compile time (for example, a macro or som开发者_如何学编程ething like like that). I want to change the path of my output files based on this determination. So, if I'm building from within Visual Studio I would put my output files in FolderA but if I'm building from the command line I would put my output files in FolderB. Is this possible?


Perhaps you can pass in a command-line parameter when building from the command-line that would indicate you are building the solution from the command-line. Otherwise, you can assume you are building from within Visual Studio.


I don't have the answer to your general question, but in order to change the output path, have you thought of adding project configurations ? You could copy project configurations and update the output path of the new ones.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号