How can I add SSH.NET NuGet packages into my Azure Functions v2.0?

柔情痞子 提交于 2019-12-08 04:58:58

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/57966783/how-can-i-add-ssh-net-nuget-packages-into-my-azure-functions-v2-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!