问题
I have a trouble with understanding how to use devenv.exe from TFS Build Server.
There is no default step to use devenv, so I tried to use PowerShell sсript to execute devenv.exe with parameters. There are no errors in build process but I see that build result files are not updated. If I execute the script manually on a agent-machine, the build passes successfully. That is my script:
$process = [System.Diagnostics.Process]::Start( "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe", "/Rebuild ""MyConfig"" ""C:\agent\agent\_work\1\s\MyProject.sln"" /Project ""C:\agent\agent\_work\1\s\MyProject\MyProject.dwproj""")
$process.WaitForExit()
As you see now I do not use variables for source paths, but I will use it if script will work.
I also have to say that I could not find any logs with errors. Maybe I do not know where to find them?
So,
- What am I doing wrong in powershell script?
- What is the best practice to build project using devenv.exe in TFS Build Server?
PS We are using TFS 15 RC1 (Version 15.103.25603.0).
回答1:
For now, there is no this build-in feature to support directly using devenv.exe
in vNext build task. But seems will coming in the near future:
That is not something we are working on right now, but it is something that we would take a pull request for.
chrisrpatterson commented on Jan 8
We want an input on the existing Visual Studio Build task that says use devenv (defaults to false). If true, it takes the variant path running code similar to above.
bryanmacfarlane commented on Jan 22
Source from GitHUB:
- "Visual Studio Build" build step that actually invokes devenv.com instead of msbuild?
- visual studio command-line build vnext step (devenv.com)
You can try to use a pull request provide by jmacnett which creating a customize build task.
回答2:
I found that it doesn't work only when the agent is running as a service. When I started the agent in the interactive mode, my tasks started to work correctly. Why? - I don't know.
回答3:
$argumentList = ("`"$solnPath`" /$solnCmdSwitch $solnConfigName")
if project then add folowing
$argumentList += (" /project `"$projPath`" /projectconfig $projConfigName")
See the extra back-quotes
来源:https://stackoverflow.com/questions/38957012/build-project-using-devenv-exe-in-tfs-15rc1-build-server