Disable system sleep during long builds
From time to time I need to run a full build of the entire tool chain for our software on my development machine. To save on power my I've got my dev machine set to go sleep after 20 minutes of inactivity. Building the full tool chain can take up to an hour and I'll often just go to lunch. However, if I forget to disable sleep开发者_如何学Python I can return to a sleeping machine with the build only partially complete.
What I'm looking for is a way to automatically disable sleep while MSBuild is running. Does anyone know of a simple way of doing this?
Add pre-build/post-build events to stop and start the power service respectively perhaps ? Create a power scheme that disables sleeping and then add use the powercfg /setactive switch. For example:
powercfg /setactive YourNewSchemesGUID
GUIDs can be enumerated using the /query switch.
精彩评论