transform-projects.visualstudio.com, using hosted build agent - Agent.Version = 1.101.2
(Copy of vsts-tasks issue #1976)
I have VS2015 with Update 3 and the RTM release of .NET Core and created a web app using the built in VS project template. The only change I made was to remove the prepublish script from project.json.
I have a build configuration, using the a machine from the Hosted pool, that has three command line tasks:
It fails on the restore task with the following error:
2016-06-29T10:20:24.2675925Z log : Restore failed in 139540ms.
2016-06-29T10:20:24.2775930Z Errors in C:\a\1\s\WebApplication1\src\WebApplication1\project.json
2016-06-29T10:20:24.2785928Z Package Microsoft.DotNet.ProjectModel.Loader 1.0.0-preview2-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.ProjectModel.Loader 1.0.0-preview2-003121 supports: netstandard1.6 (.NETStandard,Version=v1.6)
2016-06-29T10:20:24.2785928Z Package Microsoft.DotNet.Cli.Utils 1.0.0-preview2-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.Cli.Utils 1.0.0-preview2-003121 supports:
2016-06-29T10:20:24.2796163Z - net451 (.NETFramework,Version=v4.5.1)
2016-06-29T10:20:24.2796163Z - netstandard1.6 (.NETStandard,Version=v1.6)
2016-06-29T10:20:24.2805926Z One or more packages are incompatible with .NETCoreApp,Version=v1.0.
2016-06-29T10:20:24.2805926Z Package Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121 supports:
2016-06-29T10:20:24.2815928Z - net451 (.NETFramework,Version=v4.5.1)
2016-06-29T10:20:24.2815928Z - netstandard1.6 (.NETStandard,Version=v1.6)
2016-06-29T10:20:24.2825922Z One or more packages are incompatible with .NETCoreApp,Version=v1.0.
2016-06-29T10:20:24.2825922Z Package Microsoft.AspNetCore.Mvc 1.0.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.AspNetCore.Mvc 1.0.0 supports:
2016-06-29T10:20:24.2825922Z - net451 (.NETFramework,Version=v4.5.1)
2016-06-29T10:20:24.2835924Z - netstandard1.6 (.NETStandard,Version=v1.6)
2016-06-29T10:20:24.2835924Z Package Microsoft.DotNet.ProjectModel.Loader 1.0.0-preview2-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.ProjectModel.Loader 1.0.0-preview2-003121 supports: netstandard1.6 (.NETStandard,Version=v1.6)
2016-06-29T10:20:24.2845920Z Package Microsoft.DotNet.Cli.Utils 1.0.0-preview2-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.Cli.Utils 1.0.0-preview2-003121 supports:
2016-06-29T10:20:24.2845920Z - net451 (.NETFramework,Version=v4.5.1)
2016-06-29T10:20:24.2855928Z - netstandard1.6 (.NETStandard,Version=v1.6)
2016-06-29T10:20:24.2855928Z One or more packages are incompatible with .NETCoreApp,Version=v1.0.
2016-06-29T10:20:24.2865919Z NuGet Config files used:
2016-06-29T10:20:24.2865919Z C:\Users\buildguest\AppData\Roaming\NuGet\NuGet.Config
2016-06-29T10:20:24.2875923Z C:\ProgramData\nuget\Config\Microsoft.VisualStudio.Offline.config
2016-06-29T10:20:24.2875923Z Feeds used:
2016-06-29T10:20:24.2875923Z https://api.nuget.org/v3/index.json
2016-06-29T10:20:24.2885929Z C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
I cannot recreate this issue locally. Do the machines in the Hosted app pool need to be upgraded too?
Cheers,
Andy
I've uploaded the project.json
I've uploaded the donet cli version
2016-06-29T10:47:08.5609490Z dotnet --info
2016-06-29T10:47:08.5609490Z Error message highlight pattern:
2016-06-29T10:47:08.5619496Z Warning message highlight pattern:
2016-06-29T10:47:10.1671732Z .NET Command Line Tools (1.0.0-preview1-002702)
2016-06-29T10:47:10.1811724Z Product Information:
2016-06-29T10:47:10.1835180Z Version: 1.0.0-preview1-002702
2016-06-29T10:47:10.1835180Z Commit Sha: 6cde21225e
2016-06-29T10:47:10.1841732Z Runtime Environment:
2016-06-29T10:47:10.1881719Z OS Name: Windows
2016-06-29T10:47:10.1881719Z OS Version: 6.3.9600
2016-06-29T10:47:10.1891723Z OS Platform: Windows
2016-06-29T10:47:10.1891723Z RID: win81-x64
I have version 1.0.0-preview2-003121 installed locally.
If this is related to version, how long before you upgrade the machines?
I've also been having these issues. I do have a global.json, which I can drop the version of dotnet down to preview1 rather than 2. But then we get new issues with the Razor tool not being compatible. Dropping the version number of that to 1.0.0-preview1-final leaves me with this one finally:
Package Newtonsoft.Json 8.0.3 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Newtonsoft.Json 8.0.3 supports:
- net20 (.NETFramework,Version=v2.0)
- net35 (.NETFramework,Version=v3.5)
- net40 (.NETFramework,Version=v4.0)
- net45 (.NETFramework,Version=v4.5)
- portable-dnxcore50+net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=net45+wp80+win8+wpa81+dnxcore50)
- portable-net40+sl5+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile328)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.
Package Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121 supports:
- net451 (.NETFramework,Version=v4.5.1)
- netstandard1.6 (.NETStandard,Version=v1.6)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.
I think the solution is to update the version of dotnet on the hosted build agent (I'm attempting to get VSTS to build this for me). But its not very clear how to do this (or if this is a thing I should even be doing!)
the dotnet core tooling on hosted build machine will be upgrade to latest later this week or early next week.
Have you tried installing net core tools at build time? That's what net core recommends for CI servers:
https://docs.microsoft.com/en-us/dotnet/articles/core/tools/dotnet-install-script
https://docs.microsoft.com/en-us/dotnet/articles/core/tools/using-ci-with-cli#using-the-installer-script
Either that or wait for the convenience one installed on our image but that's always latent.
I made my own build agent which solved it. Horray for the hosted build being usable again soon :)
@TingluoHuang thanks for the update.
In the meantime, I'll try out your suggestion @bryanmacfarlane
Thanks for your help guys.
@bryanmacfarlane Thanks for the suggestion, but even after running the install scripts. dotnet --version still reports preview1. Neet to figure out why.
Heres the output from a vsts build:
2016-07-07T20:46:34.5257292Z curl https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.ps1 --output dotnet-install.ps1
2016-07-07T20:46:34.5257292Z Error message highlight pattern:
2016-07-07T20:46:34.5267292Z Warning message highlight pattern:
2016-07-07T20:46:34.5267292Z C:\Windows\system32\cmd.exe /c "curl https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.ps1 --output dotnet-install.ps1"
2016-07-07T20:46:35.1052921Z % Total % Received % Xferd Average Speed Time Time Time Current
2016-07-07T20:46:35.1062930Z Dload Upload Total Spent Left Speed
2016-07-07T20:46:35.1838740Z 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
2016-07-07T20:46:35.1838740Z 100 13938 100 13938 0 0 123k 0 --:--:-- --:--:-- --:--:-- 172k
2016-07-07T20:46:35.2458750Z Finishing task: CmdLine
2016-07-07T20:46:35.2708732Z Starting task: PowerShell Script
2016-07-07T20:46:35.2778844Z . 'C:\a\1\s\dotnet-install.ps1'
2016-07-07T20:46:35.3218773Z C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$env:PSModulePath= $env:PSModulePath + ';' + $([system.io.path]::combine($env:AGENT_HOMEDIRECTORY, 'agent\worker\modules')); try { [System.Security.Cryptography.ProtectedData] | Out-Null } catch { Write-Verbose 'Adding assemly: System.Security' ; Add-Type -AssemblyName 'System.Security' ; [System.Security.Cryptography.ProtectedData] | Out-Null } ; Invoke-Expression -Command ([System.Text.Encoding]::UTF8.GetString([System.Security.Cryptography.ProtectedData]::Unprotect([System.Convert]::FromBase64String('AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAMlSgc4qhNUacN5zQlTrKTgAAAAACAAAAAAAQZgAAAAEAACAAAACuYnMfkkLmk4lf8vuZqE6wuj01arqcaTZmRyHx/FACVQAAAAAOgAAAAAIAACAAAACuY8rlsy5N756qCbGJT5Ikm+0N2VAnKTzybZXi7g8cxTAAAABsUW0zuOXTdW4xnOnxqk/GXEOXJbbS4HN3/kpLwC3qHDf+J8TLiHAitxOpMb8+ThRAAAAAUoUAHrR2X8J/HTvrCoUbpKqS+ePAAA9ZSWHhJKi49yxJwJmye4cIGFyPGv3cf1uG6RM4O2aspd/ooZvvznllYg=='), [System.Convert]::FromBase64String('k8YsBIVzSh5fqFgDQa7gWQ=='), [System.Security.Cryptography.DataProtectionScope]::CurrentUser))) ; if (!(Test-Path -LiteralPath variable:\LastExitCode)) { Write-Verbose 'Last exit code is not set.' } else { Write-Verbose ('$LastExitCode: {0}' -f $LastExitCode) ; exit $LastExitCode }"
2016-07-07T20:46:35.3233836Z Executing the following powershell script. (workingFolder = C:\a\1\s)
2016-07-07T20:46:35.3244036Z C:\a\1\s\dotnet-install.ps1
2016-07-07T20:46:40.8389678Z dotnet-install: Downloading https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/1.0.0-preview2-003121/dotnet-dev-win-x64.1.0.0-preview2-003121.zip
2016-07-07T20:46:46.9619791Z dotnet-install: Extracting zip from https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/1.0.0-preview2-003121/dotnet-dev-win-x64.1.0.0-preview2-003121.zip
2016-07-07T20:46:50.1910226Z dotnet-install: Adding to current process PATH: "C:\Users\buildguest\AppData\Local\Microsoft\dotnet\". Note: This change will not be visible if PowerShell was run as a child process.
2016-07-07T20:46:50.1950219Z dotnet-install: Installation finished
2016-07-07T20:46:50.2180216Z Finishing task: PowerShell
2016-07-07T20:46:50.2260218Z Starting task: Run setx
2016-07-07T20:46:50.2280221Z ##[warning]File name doesn't indicate a full path to a executable file.
2016-07-07T20:46:50.2290221Z Executing the following command-line. (workingFolder = C:\a\1\s)
2016-07-07T20:46:50.2300228Z setx PATH "C:\Users\buildguest\AppData\Local\Microsoft\dotnet\;%PATH%"
2016-07-07T20:46:50.2300228Z Error message highlight pattern:
2016-07-07T20:46:50.2310219Z Warning message highlight pattern:
2016-07-07T20:46:50.2530283Z C:\Windows\system32\cmd.exe /c "setx PATH "C:\Users\buildguest\AppData\Local\Microsoft\dotnet\;%PATH%""
2016-07-07T20:46:51.4550903Z WARNING: The data being saved is truncated to 1024 characters.
2016-07-07T20:46:51.4610901Z SUCCESS: Specified value was saved.
2016-07-07T20:46:51.4670983Z Finishing task: CmdLine
2016-07-07T20:46:51.4791070Z Starting task: Run dotnet
2016-07-07T20:46:51.4820915Z ##[warning]File name doesn't indicate a full path to a executable file.
2016-07-07T20:46:51.4830947Z Executing the following command-line. (workingFolder = C:\a\1\s)
2016-07-07T20:46:51.4840922Z dotnet --version
2016-07-07T20:46:51.4850958Z Error message highlight pattern:
2016-07-07T20:46:51.4860915Z Warning message highlight pattern:
2016-07-07T20:46:51.4860915Z C:\Windows\system32\cmd.exe /c "dotnet --version"
2016-07-07T20:46:52.9448861Z 1.0.0-preview1-002702
2016-07-07T20:46:52.9598829Z Finishing task: CmdLine
re-opening for guidance
I got it working, https://twitter.com/pksorensen/status/751166141784002561, but I had to be specific about the path to dotnet and not able to just use the path variables.
Anyway, just published my aspet core 1.0.0 on vsts.
@pksorensen try using batch task instead of powershell task to call the powershell script (you might need to add a wrapper .cmd file, which will call PowerShell.exe ./yourscript.ps1), the batch task has an check box 'modify environment', check that, this will allow the script modify the environment variable of the agent. regular powershell task doesn't have this option.
@TingluoHuang @pksorensen Using a batch task to call a .cmd file fixed the restore step for me. My .cmd file looks like this:
PowerShell.exe ./dotnet-install.ps1 -InstallDir build
Thanks for the suggestion @TingluoHuang!
I added a curl command to download https://gist.githubusercontent.com/pksorensen/e9c4afd997e0c5e35a7f1e052c065f8e/raw/da6ea816144ec614b7d4fd9f99b7d02c595ffbd2/vsts-aspnet-core-preview2-install.cmd -o vsts-aspnet-core-preview2-install.cmd
and then a batch script to run it.
but dotnet --version is still at preview1.
I just keep running my dotnet commands like $(build.sourcesdirectory)\build\dotnet
@pksorensen did you check the check box 'modify environment' on Batch Task?
@TingluoHuang Ye i did. Curious if others made it update to preview2 in this way. If so, please show log output.
@pksorensen here is my batch script that make it work.
install.cmd:
PowerShell.exe ./dotnet-install.ps1 -InstallDir build
set Path=%BUILD_SOURCESDIRECTORY%\build;%Path%
I uploaded my build log.
1_Build.txt
@pksorensen I just install the tools to a known location and use the full path to the exe, like so:
Run PowerShell script task:
dotnet-install.ps1 -InstallDir $(Build.SourcesDirectory) -NoPath
Command line task:
$(Build.SourcesDirectory)/dotnet.exe --info
2016-07-08T09:33:45.3432988Z .NET Command Line Tools (1.0.0-preview3-003178)
2016-07-08T09:33:45.3462986Z Product Information:
2016-07-08T09:33:45.3462986Z Version: 1.0.0-preview3-003178
2016-07-08T09:33:45.3472983Z Commit SHA-1 hash: dedf3f981e
2016-07-08T09:33:45.3482979Z Runtime Environment:
2016-07-08T09:33:45.3482979Z OS Name: Windows
2016-07-08T09:33:45.3482979Z OS Version: 6.3.9600
2016-07-08T09:33:45.3492975Z OS Platform: Windows
2016-07-08T09:33:45.3492975Z RID: win81-x64
Thanks.
@pksorensen - can you confirm?
I also put together a blog article on how I managed to finally get this working, including a deploy to Azure step:
https://shifted.azurewebsites.net/2016/07/12/continuous-deployment-of-net-core-rtm-to-azure-with-vsts/
The hosted vms have been updated to the latest .NET Core tooling
Nice that the VMS has been updated.
To the prior questions, yes $(Build.SourcesDirectory)/dotnet.exe --info also works for me.
What I never got to work was changing the path variables such dotnet.exe --info yielded same result, but we can live without that.