无法在 VSTS 中构建已编译的 Azure 函数(错误 MSB4019)

Unable to build Compiled Azure Function in VSTS (Error MSB4019)

我使用 visual studio 2017 (15.3.1) 的最新版本创建了一个 Azure Functions。

此版本允许我执行以下操作:

新建项目 > Azure Function App 方法

这会生成一个 .csproj(不是 .funproj 文件)并且它没有与网站或任何东西捆绑在一起。我已经尝试将 .Net 4.6 和 4.6.1 作为目标框架,但都没有用。

我在 VSTS 中收到以下错误:

C:\Users\Builder.nuget\packages\microsoft.net.sdk.functions.0.2\build\netstandard1.0\Microsoft.NET.Sdk.Functions.Publish.props (13, 3) C:\Users\Builder.nuget\packages\microsoft.net.sdk.functions.0.2\build\netstandard1.0\Microsoft.NET.Sdk.Functions.Publish.props(13,3): Error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk.Publish\Sdk\Sdk.Props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

我的 .csproj 文件中没有节点,所以我不确定它是从哪里获取的。

我在 VSTS 中使用最新的 NuGet 选项,我也在使用最新的 VS 版本选项。

构建步骤为:

现在有什么方法可以在 VSTS 中构建(然后发布)已编译的 .Net 函数吗?

机器似乎缺少最新的 dotnet cli。我不太熟悉 VSTS 构建机器,但你需要以某种方式将其安装到那里 https://www.microsoft.com/net/download/core

我能够通过将构建代理从 "Default" 组交换到最新的 "Hosted VS 2017" 组来解决这个问题,并且编译正常。