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

查看:67
本文介绍了如何将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:\ home \ site \ wwwroot \ bin \ Renci.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:\home\site\wwwroot\bin\Renci.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天全站免登陆