[英]Azure Function Queue Trigger Adding Nuget Package
[英]Including a NuGet package in an Azure function written in the Portal
我在門戶中創建了一個新的Azure函數,並想使用WindowsAzure.Storage
NuGet包。 假定使用以下方式創建了默認模板:
#r "Newtonsoft.Json"
我以為我可以這樣做:
#r "WindowsAzure.Storage"
但是,當我這樣做時,出現錯誤:
[Error] run.csx(2,1): error CS0006: Metadata file 'WindowsAzure.Storage' could not be found
我在其他地方看不到被引用的Newtonsoft.Json
。
我如何在函數中包含此NuGet包(不構建VS或VS Code並進行部署)。 另外,如果沒有引入外部庫和包,那么#r
指令究竟能做什么?
好的,所以每次我創建一個Function應用程序時,我大多都是出於對智能和工作的便利性而使用VS Code或Visual Studio。 從Azure門戶添加nuget
View Files
並添加一個function.proj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="WindowsAzure.Storage" Version="9.3.3"/>
</ItemGroup>
</Project>
保存后,您應該看到控制台更新說明正在安裝軟件包。 微軟文檔中確實沒有對此進行很好的記錄
名稱空間中有更正
#r“ Microsoft.WindowsAzure.Storage”
而不是#r“ WindowsAzure.Storage”
您可以參考-https: //docs.microsoft.com/zh-cn/azure/azure-functions/functions-reference-csharp#binding-to-arguments
嘗試使用#r“ Microsoft.WindowsAzure.Storage”
您還可以通過Kudu工具將自定義dll上傳到功能應用中。 然后您可以通過#r“ dll的路徑”引用dll。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.