0

Trying to create a Jenkins pipeline to run devenv to build SSIS projects. It appears that devenv returns immediately while the build runs in the background. I've done this previously with VS2010 and as far as I can remember devenv didn't return to the console until the build completed.

I'm running: devenv mysolution.sln /build "debug|Any Cpu". The command prompt returns immediately. There's no build output in the project's bin or obj folders. If I simply watch the folders the build output eventually (a few seconds) shows up.

Is there any way to ensure devenv doesn't return until all the work is complete? I've tried all the options that seem to be relevant from the command line help. Not much on Google or SO seems relevant.

Any thoughts?

Richard Schaefer
  • 525
  • 3
  • 13
  • 45
  • is running `msbuild mysolution.sln` an option? I believe you can [build SSIS projects](https://stackoverflow.com/questions/37217520/how-to-have-msbuild-process-all-ssis-projects) – timur Mar 06 '20 at 08:39
  • @timur That's not an option for us. We have to use the MS defined process (it's a compliance thing) which is command-line devenv. – Richard Schaefer Mar 06 '20 at 11:46
  • right. are you able to run devenv from a batch file? then you could potentially [wait until the build process exits](https://stackoverflow.com/questions/8177695/how-to-wait-for-a-process-to-terminate-to-execute-another-process-in-batch-file) before exiting the batch. – timur Mar 08 '20 at 21:47
  • Hmm... I'm running a Groovy script inside Jenkins. I'll have to see if I can figure out how to do this in Groovy. – Richard Schaefer Mar 09 '20 at 10:42
  • @timur I set up Jenkins to run devenv then use Powershell to loop over a Get-Process to check for it. Problem I'm having now is there is no output from devenv. I'm getting an rc=1 but I have no idea why. i tried /out:buildlog.txt but it creates no file. Here's my command: devenv.exe adsmetricsetl.sln /build "debug|any cpu" It works from my command prompt as well but the same, no output. Thoughts? – Richard Schaefer Mar 09 '20 at 16:49
  • when you run it in command prompt - do you get output at all? What does [/log](https://learn.microsoft.com/en-us/visualstudio/ide/reference/log-devenv-exe?view=vs-2019) do for you?I would also suggest try set absolute paths to ensure you know where to look – timur Mar 09 '20 at 18:10
  • I think I have a problem with my VS install on my build server. I replicated the entire process on my desktop and it works including the /out log file. I've got to poke at the VS install on my build server where I'm having the problem. Can you post an answer so I can award the bounty. – Richard Schaefer Mar 10 '20 at 11:36
  • I ran repair on VS on the build server and it fixed the problem. – Richard Schaefer Mar 10 '20 at 13:32
  • The real answer was use devenv.com, not devenv.exe :-) – Richard Schaefer Mar 10 '20 at 18:36

1 Answers1

0

Option 1: msbuild

Probaby, by far the easiest would've been to use msbuild. SSIS is supported like outlined in this SO answer

msbuild /t:Build /p:Configuration=Debug your_solution.sln

this however, wasn't an option for you, therefore

Option 2: spawn process and wait till devenv finishes

one opiton to do it in Powershell is Get-Process as outlined in this SO answer

to capture outputs you might opt for /out or/and /log like so:

devenv.exe your_solution.sln /build "debug|any cpu" /out "c:\buildlog.txt"

Upd this part of documentation seems to explain the difference between different devenv flavours:

Commands that begin with devenv are handled by the devenv.com utility, which delivers output through standard system streams, such as stdout and stderr. The utility determines the appropriate I/O redirection when it captures output, for example to a .txt file.

Alternatively, commands that begin with devenv.exe can use the same switches, but the devenv.com utility is bypassed. Using devenv.exe directly prevents output from appearing on the console.

Community
  • 1
  • 1
timur
  • 14,239
  • 2
  • 11
  • 32