Azure 预编译的 C# 函数如何在 VS2017 中本地构建,而不是在 VSTS MSBuild 中构建?

How can an Azure precompiled C# function build locally in VS2017, but not in VSTS MSBuild?

Azure 预编译的 C# 函数如何在本地编译,而不是在 VSTS 中编译?

我使用了 Visual Studio 2017 Tools for Azure Functions 的最新预览版以及 VS 2017 预览版 3 创建了一个简单的 HttpTrigger 函数。 VS sln 在本地编译得很好。

我也可以从 VS 成功发布到 Azure ... 最终!!

第一次失败,但 shell 是在 Azure 中创建的。第二次发布实际上获得了 json 和 dll 到 Azure。

我想我会在 VSTS 中快速构建 CI,并遵循 Donna Malayeri post 中的详细信息。

但是 VSTS 在构建解决方案任务中显示了很多错误,例如

2017-07-11T13:51:59.3254765Z ##[error]SmcPrecompileFunctionApp\TriggerByHttp.cs(14,10): Error CS0246: The type or namespace name 'FunctionNameAttribute' could not be found (are you missing a using directive or an assembly reference?)
2017-07-11T13:51:59.3254765Z TriggerByHttp.cs(14,10): error CS0246: The type or namespace name 'FunctionNameAttribute' could not be found (are you missing a using directive or an assembly reference?) [d:\a\s\SmcPrecompileFunctionApp\SmcPrecompileFunctionApp.csproj]

仔细检查,代理设置为 Hosted VS2017

确保您在 NuGet 构建任务中使用的是最新版本的 NuGet。由于某些原因,较低版本无法正确恢复所有包。