开发者

How can I run msbuild from a windows service?

开发者 https://www.devze.com 2023-04-11 13:29 出处:网络
I\'m trying to run this batch file from a windows service (running as my own user) and msbuild doesn\'t work. Running it directly however, works. I\'m getting a buch of \"The handle is invalid\" on st

I'm trying to run this batch file from a windows service (running as my own user) and msbuild doesn't work. Running it directly however, works. I'm getting a buch of "The handle is invalid" on stderr from I presume vcvarsall.bat.

rem Load compilation environment
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
rem Load the All Solutions.sln progr开发者_JS百科am
msbuild "C:\AutoBuildCheckout\Other Projects\All Projects\All Projects.sln"
pause

I'm confused. Anyone have any suggestions?

-Isaac


Services in Windows Vista and higher run in a separate desktop, and therefore don't have access to stdin, stdout, and stderr. (Services can no longer 'interact with desktop'; you'll notice that option is missing from the services applet in Control Panel.)

EDIT: After the comments below... A service IMO is the wrong solution. There are continuous integration products that manage this for you, like Hudson or CruiseControl; I'm sure there are many others. See also Continuous Integration at Wikipedia for more info.


My solution was to just not call vcvarsall.bat. Instead I'm directly summoning msbuild from where it sits in the windows directory. So I got around the problem without really knowing the solution.

0

精彩评论

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