Build Error with pre-compiled Azure Function Library(使用预编译的 Azure 函数库生成错误)
问题描述
最近,我使用 *.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 函数库生成错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用预编译的 Azure 函数库生成错误
基础教程推荐
- WPF 模态进度窗口 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
