0
votes

I have a solution with 30 odd projects in it that I am trying to build with the TFS2017 build process. Currently I am hitting some speed bumps.

The projects were created in the RTM version of VS2017 and are building with msbuild on the dev machine completely fine. I have also transferred the project between machines only running dotnet restore to get all the dependencies working.

The only change to the projects that is not 'stock' is that I am targeting both NET46 and NETCORE using the <TargetFrameworks /> parameter in the csproj.

Below are the steps I have taken to set up TFS in order to build the projects. Steps 4, 5 and 6 are attempts at getting it working to no avail.

The error that I am constantly provided with is that TFS can't find the dotnet executable, as you will be able to see in the log outputs at the bottom.

  1. Install TFS 2017 - this was an upgrade from 2015
  2. Install VS 2017 on the build server making sure that all frameworks and compilers were installed.
  3. Launch VS as the build server account, and create and build a new net core project as suggested here (https://stackoverflow.com/a/38173701/2302383)
  4. Set up the build described here (https://www.visualstudio.com/en-us/docs/build/apps/aspnet/ci/build-aspnet-core).
  5. Clone an existing build that works on 4.5.2 and add the dotnet restore command.
  6. Use the Net Core preview build template to create a build.

Debug log of step 4 & 5 (uses cmd task with dotnet restore)

2017-07-05T15:11:46.5154865Z ##[warning]File name doesn't indicate a full path to a executable file.
2017-07-05T15:11:46.5174870Z Executing the following command-line. (workingFolder = E:\VsoAgents\agent1\_work\31\s)
2017-07-05T15:11:46.5204867Z dotnet restore
2017-07-05T15:11:46.5214870Z Error message highlight pattern: 
2017-07-05T15:11:46.5214870Z Warning message highlight pattern: 
2017-07-05T15:11:46.5224872Z C:\Windows\system32\cmd.exe /c "dotnet restore"
2017-07-05T15:11:46.5624906Z 'dotnet' is not recognized as an internal or external command,
2017-07-05T15:11:46.5634910Z operable program or batch file.

Debug log of step 6 (sensitive info has been replaced by [[REDACTED]])

2017-07-05T15:15:37.1734770Z Set workingFolder to default: E:\VsoAgents\agent1\tasks\DotNetCoreCLI\0.3.1
2017-07-05T15:15:37.7375119Z ##[debug]agent.workFolder=E:\VsoAgents\agent1\_work
2017-07-05T15:15:37.7385124Z ##[debug]loading inputs and endpoints
2017-07-05T15:15:37.7415122Z ##[debug]loading ENDPOINT_AUTH_$/
2017-07-05T15:15:37.7455138Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_$/_ACCESSTOKEN
2017-07-05T15:15:37.7465136Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2017-07-05T15:15:37.7475134Z ##[debug]loading ENDPOINT_AUTH_SCHEME_$/
2017-07-05T15:15:37.7485123Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2017-07-05T15:15:37.7495157Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2017-07-05T15:15:37.7505131Z ##[debug]loading INPUT_COMMAND
2017-07-05T15:15:37.7515125Z ##[debug]loading INPUT_PROJECTS
2017-07-05T15:15:37.7525123Z ##[debug]loading INPUT_PUBLISHWEBPROJECTS
2017-07-05T15:15:37.7535143Z ##[debug]loading INPUT_ZIPAFTERPUBLISH
2017-07-05T15:15:37.7545134Z ##[debug]loaded 10
2017-07-05T15:15:38.1705390Z ##[debug]command=restore
2017-07-05T15:15:38.1715403Z ##[debug]projects=**/project.json
2017-07-05T15:15:38.1725392Z ##[debug]arguments=null
2017-07-05T15:15:38.1735387Z ##[debug]publishWebProjects=true
2017-07-05T15:15:38.1745389Z ##[debug]zipAfterPublish=true
2017-07-05T15:15:38.1755406Z ##[debug]check path : E:\VsoAgents\agent1\tasks\DotNetCoreCLI\0.3.1\task.json
2017-07-05T15:15:38.1765390Z ##[debug]set resource file to: E:\VsoAgents\agent1\tasks\DotNetCoreCLI\0.3.1\task.json
2017-07-05T15:15:38.1775415Z ##[debug]system.culture=en-US
2017-07-05T15:15:38.1825417Z ##[debug]Absolute path for pathSegments: C:\Program Files\Python 3.5\Scripts\/dotnet = C:\Program Files\Python 3.5\Scripts\dotnet
2017-07-05T15:15:38.1835414Z ##[debug]Absolute path for pathSegments: C:\Program Files\Python 3.5\/dotnet = C:\Program Files\Python 3.5\dotnet
2017-07-05T15:15:38.1845418Z ##[debug]Absolute path for pathSegments: C:\Windows\system32/dotnet = C:\Windows\system32\dotnet
2017-07-05T15:15:38.1855401Z ##[debug]Absolute path for pathSegments: C:\Windows/dotnet = C:\Windows\dotnet
2017-07-05T15:15:38.1855401Z ##[debug]Absolute path for pathSegments: C:\Windows\System32\Wbem/dotnet = C:\Windows\System32\Wbem\dotnet
2017-07-05T15:15:38.1865430Z ##[debug]Absolute path for pathSegments: C:\Windows\System32\WindowsPowerShell\v1.0\/dotnet = C:\Windows\System32\WindowsPowerShell\v1.0\dotnet
2017-07-05T15:15:38.1875421Z ##[debug]Absolute path for pathSegments: %USERPROFILE%\.dnx\bin/dotnet = E:\VsoAgents\agent1\tasks\DotNetCoreCLI\0.3.1\%USERPROFILE%\.dnx\bin\dotnet
2017-07-05T15:15:38.1885418Z ##[debug]Absolute path for pathSegments: C:\Program Files\Microsoft DNX\Dnvm\/dotnet = C:\Program Files\Microsoft DNX\Dnvm\dotnet
2017-07-05T15:15:38.1895423Z ##[debug]Absolute path for pathSegments: C:\Program Files\Microsoft SQL Server\120\Tools\Binn\/dotnet = C:\Program Files\Microsoft SQL Server\120\Tools\Binn\dotnet
2017-07-05T15:15:38.1905429Z ##[debug]Absolute path for pathSegments: C:\Program Files\Microsoft Office Servers\15.0\Bin\/dotnet = C:\Program Files\Microsoft Office Servers\15.0\Bin\dotnet
2017-07-05T15:15:38.1915417Z ##[debug]Absolute path for pathSegments: C:\Program Files\Babel/dotnet = C:\Program Files\Babel\dotnet
2017-07-05T15:15:38.1925419Z ##[debug]Absolute path for pathSegments: C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\/dotnet = C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\dotnet
2017-07-05T15:15:38.1935419Z ##[debug]Absolute path for pathSegments: C:\Program Files\Microsoft SQL Server\110\Tools\Binn\/dotnet = C:\Program Files\Microsoft SQL Server\110\Tools\Binn\dotnet
2017-07-05T15:15:38.1945409Z ##[debug]Absolute path for pathSegments: C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\/dotnet = C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\dotnet
2017-07-05T15:15:38.1955423Z ##[debug]Absolute path for pathSegments: C:\Program Files\Microsoft\Web Platform Installer\/dotnet = C:\Program Files\Microsoft\Web Platform Installer\dotnet
2017-07-05T15:15:38.1955423Z ##[debug]Absolute path for pathSegments: C:\Program Files (x86)\NuGet/dotnet = C:\Program Files (x86)\NuGet\dotnet
2017-07-05T15:15:38.1965419Z ##[debug]Absolute path for pathSegments: C:\Program Files\Microsoft SQL Server\130\Tools\Binn\/dotnet = C:\Program Files\Microsoft SQL Server\130\Tools\Binn\dotnet
2017-07-05T15:15:38.1975423Z ##[debug]Absolute path for pathSegments: C:\Users\[[REDACTED]]\.dnx\bin/dotnet = C:\Users\[[REDACTED]]\.dnx\bin\dotnet
2017-07-05T15:15:38.1985426Z ##[debug]check path : null
2017-07-05T15:15:38.2065429Z ##[debug]task result: Failed
2017-07-05T15:15:38.2245432Z ##[error]Error: Failed which: Not found dotnet: null
1
Did you restart the build agent service after installing VS? It might not have picked up the changes to your system's PATH environment variable. also check this variable is set system-wide an not only for the user you installed VS with.Martin Ullrich
"Hey Mike, have you tried turning it off and then on again?" ... :| - Thank you @MartinUllrich, it turns out I am an idiot.Michael Coxon
@starain-MSFT I actually just rebooted the whole machine. After that everything was perfect.Michael Coxon
You can post an answer.starian chen-MSFT
Added it as an answer. @MichaelCoxon you're definitely not an idiot for this - guess how I came up with that suggestion so fast ;) (or at least that makes two of us)Martin Ullrich

1 Answers

1
votes

The agent scan's the PATH and other environment-related configuration on startup so you'll need to restart the agent service for environment-related changes to take effect. The more complete approach is to just reboot the machine which will allow all system-wide changes made by installing/updating components to take effect.