Pregunta

I have a post build app that takes a long time to execute. So I need to execute it only when I really need it. Is there a way to execute such an app only when I've pressed a key (eg. SHIFT) and built the project at the same time?

¿Fue útil?

Solución

That's going to be a bit difficult, build events execute in a hidden console mode app, started by msbuild.exe. Directly interacting with the user is not an option.

One thing you can do is write a little program that calls/pinvokes GetAsyncKeyState() to check if VK_SHIFT is down. And set the process exit code accordingly. Which you can then call in your post build event and use if %ERRORLEVEL% to check that return value.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top