使用预编译的Azure函数库生成错误 [英] Build Error with pre-compiled Azure Function Library

查看:105
本文介绍了使用预编译的Azure函数库生成错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我使用

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 \ ray \ .nuget \ packages \ microsoft.net.sdk.functions \ 1.0.2 \ build \ netstandard1.0 \ Microsoft.NET.Sdk.Functions.Build.targets(31,5):错误:无法加载文件或程序集"Microsoft.Azure.WebJobs.Host,版本= 2.1.0.0,文化=中性,PublicKeyToken = 31bf3856ad364e35".该系统找不到指定的文件.

C:\Users\ray\.nuget\packages\microsoft.net.sdk.functions\1.0.2\build\netstandard1.0\Microsoft.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?

推荐答案

更新2018年1月8日

根据@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,它将使用包含Microsoft.Azure.WebJobs的库的.NETFramework 4.6版本.

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. I've written a tutorial on how to do this.

这篇关于使用预编译的Azure函数库生成错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆