如何将 SSH.NET NuGet 包添加到我的 Azure Functions v2.0? [英] How can I add SSH.NET NuGet packages into my Azure Functions v2.0?

查看:11
本文介绍了如何将 SSH.NET NuGet 包添加到我的 Azure Functions v2.0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 Azure 函数是 v2.我已将 <PackageReference Include="SSH.NET" Version="2016.1.0"/> 添加到 function.proj 的 ItemGroup 中.

但是,#r "Renci.SshNet" 不起作用.#r "D:homesitewwwrootinRenci.SshNet.dll" 也不起作用.因为wwwroot下没有bin文件夹.

包含 Renci.SshNet 的正常方式是什么?

问候,振宇

然后点击调试控制台"-->CMD"-->站点"-->wwwroot"-->新建文件夹"并将文件夹命名为bin".

然后将dll文件拖到bin文件夹中,即可通过#r命令使用(如下图)

更新:

你可以尝试修改你的function.proj如下:

<PackageReference Include="Renci.SshNet.Async" Version="1.4.0"/>

在你的函数中使用命令using Renci.SshNet;".

并删除你之前添加的 Renci.SshNet 的#r 行.

请试一试.

my Azure function is v2. I have added <PackageReference Include="SSH.NET" Version="2016.1.0" /> into ItemGroup in function.proj.

However, #r "Renci.SshNet" is NOT working. #r "D:homesitewwwrootinRenci.SshNet.dll" is NOT working either. Because there is no bin folder under wwwroot.

What is the normal way to include Renci.SshNet?

Regards, Zhenyu

my function.proj screenshot

解决方案

You can add bin folder under wwwroot and drag the dll to it by "Advanced tools(kudu)" under azure function "Platform features" tag.

First, click "kudu" (shown as below screenshot)

Then click "Debug console" --> "CMD" --> "site" --> "wwwroot" --> "New folder" and namd the folder as "bin".

Then drag the dll file to the bin folder and then you can use it by #r command(shown as below)

Update:

You can try to modify your function.proj as below:

<PackageReference Include="Renci.SshNet.Async" Version="1.4.0" />

And in your function use the command "using Renci.SshNet;".

And remove the #r line of Renci.SshNet you added before.

Please have a try.

这篇关于如何将 SSH.NET NuGet 包添加到我的 Azure Functions v2.0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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