[英]How to access build warnings in a post-build event in Visual Studio?
[英]How to detect debug/release in visual studio pre/post-build command line?
如何从命令行预构建或构建后window 检测调试或发布模式?
我测试了下面的代码,它在代码文本 window 中工作。 它可以转换为命令行代码吗? 如果可以,怎么做,谢谢。
bool debugging = false;
#if DEBUG
debugging = true;
// do something like to move ../debug/bin/ to somewhere.
#else
debugging = false;
// do something like to move ../debug/bin/ to somewhere.
#endif
Console.WriteLine(debugging);
您可以检查$(ConfigurationName)
变量的值。
它与您在代码示例中使用的不同。 #if DEBUG
是一个条件编译指令,它取决于DEBUG
是否被定义为符号。 ConfigurationName
变量取决于您指定的构建配置(独立于条件编译符号)。
echo **** Visual Studio PREBUILD... ****
echo **** Remember these are running from command line, aka BATCH commands
echo **** watch out (include) single space after the conditional (and other ridiculous traps and pitfalls)
echo **** so I HIGHLY recommend getting out of BATCH and into Powershell as soon as possible. Make prebuild a one-liner and then put additional code in your powershell... (you will thank me later)
echo **** Read more about why I'd rather claw my eyes out than program in BATCH here: https://www.tutorialspoint.com/batch_script/batch_script_if_else_statement.htm
if "Debug" == $(ConfigurationName) (
echo OPTIONALLY just pass in the Configuration name and do all the logic and checking INSIDE the powershell. Seriously, it is way better.
powershell .\DevBox.Prebuild.ps1 -Config:$(ConfigurationName)
)
echo *** Much better to just check for Debug INSIDE the powershell
powershell .\DevBox.Prebuild.ps1 -Config:$(ConfigurationName)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.