Recently, I converted an Azure Function that used a C# script (*.csx) to a pre-complied class library using the Visual Studio Studio Tools for Azure Functions.
I was having the same issue as well when running dotnet build, but no longer have this issue after updating Microsoft.NET.Sdk.Functions from 1.0.2 to 1.0.7.
Update to the latest version of this package in your Nuget package manaager and you should be able to run dotnet build again.