1.Are you sure of the extension.proj
you are using?
From your code I know you are writing on the portal. So you should create function.proj
instead of extension.proj
on portal.
2. I see you write <PackageReference Include="Microsoft.Azure.Storage.Blob" Version="11.1.0" />
in .proj file. So you should use #r "Microsoft.WindowsAzure.Storage"
instead of
using Microsoft.WindowsAzure.Storage
Below is the code of my function.proj
, things works fine on my side. For more details, have a look of this Offical doc.(All of the solution is based on you are using function 2.x
. If you are using function 1.x
. It is not the same.)
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Storage.Blob" Version="11.1.0" />
</ItemGroup>
</Project>
![enter image description here](https://i.stack.imgur.com/1CSz1.png)
Code of my .crx file:
#r "Newtonsoft.Json"
#r "Microsoft.WindowsAzure.Storage"
using System.Net;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
using Microsoft.Azure.Storage.Blob;
public static async Task<IActionResult> Run(HttpRequest req, ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
string name = req.Query["name"];
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
dynamic data = JsonConvert.DeserializeObject(requestBody);
name = name ?? data?.name;
return name != null
? (ActionResult)new OkObjectResult($"Hello, {name}")
: new BadRequestObjectResult("Please pass a name on the query string or in the request body");
}