用门户(CSX)编写的Azure函数,带有外部引用的Nuget软件包不起作用
我正在尝试制作一个非常简单的斑点功能,我似乎无法完成这项工作。 有人知道这里有什么问题吗?
代码:
#r "SixLabors.ImageSharp"
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
public static void Run(Stream myBlob, string name, Stream imageSmall, ILogger log)
{
log.LogInformation($"C# Bolob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
using var image = Image.Load(myBlob);
int width = image.Width / 2;
int height = image.Height / 2;
image.Mutate(x => x.Resize(width, height));
image.Save(imageSmall);
}
function.proj
<PropertyGroup>
<TargetFramework>.NETCoreApp,Version=v3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackReference Include="SixLabors.ImageSharp" Version="2.1.2"/>
</ItemGroup>
of(似乎没关系):
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackReference Include="SixLabors.ImageSharp" Version="2.1.2"/>
</ItemGroup>
错误: “错误] run.csx(2,1):错误cs0006:元数据文件'sixlabors.imagesharp'找不到'无法找到”。
I am trying to make a very simple blobtriggered function, I cannot seem to make this work.
Anyone any idea what is wrong here?
Code:
#r "SixLabors.ImageSharp"
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
public static void Run(Stream myBlob, string name, Stream imageSmall, ILogger log)
{
log.LogInformation(quot;C# Bolob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
using var image = Image.Load(myBlob);
int width = image.Width / 2;
int height = image.Height / 2;
image.Mutate(x => x.Resize(width, height));
image.Save(imageSmall);
}
Function.proj
<PropertyGroup>
<TargetFramework>.NETCoreApp,Version=v3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackReference Include="SixLabors.ImageSharp" Version="2.1.2"/>
</ItemGroup>
Of (doesn’t seem to matter):
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackReference Include="SixLabors.ImageSharp" Version="2.1.2"/>
</ItemGroup>
Error:
“Error] run.csx(2,1): error CS0006: Metadata file 'SixLabors.ImageSharp' could not be found”.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
谢谢 @ Mohitganorkar-Mt 指出解决方案,将其发布为对其他社区成员的好处的答案。
对于上述内容,我们尝试使用Blob触发器创建一个Azure函数,并且从我们的末端也可以正常工作。
function.csproj
您有item group
带有packReference
而不是我们必须使用如下所示:与2.1同样
有关更多信息,请参阅此博客| 创建一个使用c# 触发的azure函数,由 @ jay jay krishna reddy em>。
Thanks @MohitGanorkar-Mt for point out the solution ,posting it as answer to benefit for other community members for the similar issue.
For the above We have tried to create an Azure function using blob trigger and it works fine as well from our end .
The
function.csproj
you haveitem group
withpackreference
instead of that we have to use as shown below:similarly with 2.1 as well
For more information please refer this BLOG|Create an Azure Function Triggered By Blob Storage Using C# by @Jay Krishna Reddy.