最近,我使用 *.csx) 的 Azure 函数转换为预编译的类库.com/webdev/2017/05/10/azure-function-tools-for-visual-studio-2017/" rel="nofollow noreferrer">适用于 Azure Functions 的 Visual Studio Studio 工具.它在 Visual Studio 2017 中成功构建(以及运行和调试).
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. It builds successfully in Visual Studio 2017 (as well as running and debugging too).
我想通过我们的 CI 流程构建这个 AF 库.但是,当我在本地运行命令 dotnet build
时,它会失败并出现以下错误:
I'd like to build this AF library via our CI process. However, when I run the command dotnet build
locally it fails with the following error:
C:Users ay.nugetpackagesmicrosoft.net.sdk.functions1.0.2uild etstandard1.0Microsoft.NET.Sdk.Functions.Build.targets(31,5):错误:无法加载文件或程序集Microsoft.Azure.WebJobs.Host,版本=2.1.0.0,文化=中性,PublicKeyToken=31bf3856ad364e35".该系统找不到指定的文件.
C:Users ay.nugetpackagesmicrosoft.net.sdk.functions1.0.2uild etstandard1.0Microsoft.NET.Sdk.Functions.Build.targets(31,5): error : Could not load file or assembly 'Microsoft.Azure.WebJobs.Host, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
同样的错误也发生在我们的 CI 构建中.
The same error also occurs in our CI build.
不确定为什么会发生此错误以及如何解决它.它是 dotnet CLI 的版本(我使用的是 v1.1)吗?是别的吗?
Not sure why this error is occurring and how to resolve it. Is it the version of the dotnet CLI (I'm using v1.1)? Is it something else?
UPDATE 2018-01-08
根据@theGRS https://stackoverflow.com/a/48156446/621827 的新回答,这有已解决.
According to a new answer by @theGRS https://stackoverflow.com/a/48156446/621827 this has been resolved.
上一个答案
这是我找到的.
dotnet msbuild
使用 Microsoft.NET.Sdk.Functions .NETStandard 1.5
库,如果您查看 NuGet 它不使用 Microsoft.Azure.WebJobs
dotnet msbuild
uses the Microsoft.NET.Sdk.Functions .NETStandard 1.5
library which if you look at the dependencies on NuGet it doesn't use Microsoft.Azure.WebJobs
但如果您使用 Visual Studio 2017 msbuild
,它将使用库的 .NETFramework 4.6
版本,其中包括 Microsoft.Azure.WebJobs
.
But if you use the Visual Studio 2017 msbuild
it will use the .NETFramework 4.6
version of the library which includes Microsoft.Azure.WebJobs
.
我的建议是现在使用 MSBuild.
My suggestion is to use MSBuild for now.
这篇关于使用预编译的 Azure 函数库生成错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!