Predefined type 'System.Void' is not defined or imported during Visual Studio Online build of ASP.NET 5

In my own issue, I rebuilt the entire solution and the errors just disappeared.


I just reproduced this issue after updating the code in "PreBuild.ps1" script to only restore the "project.json" file for web project.

Original Code (Build Success):

Get-ChildItem -Path $PSScriptRoot\src -Filter project.json -Recurse | ForEach-Object { & dnu restore $_.FullName 2>1 }

Updated Code (Build fail with: Predefined type 'System.Void' is not defined or imported):

Get-ChildItem -Path $PSScriptRoot\src\WebProjectName -Filter project.json -Recurse | ForEach-Object { & dnu restore $_.FullName 2>1 }

So you need to check the PreBuild.ps1 script and the build logs for PowerShell step to check if the project.json files for Web project and Library project are both restored.