0

I am getting error in azure cloud portal while running Azure functions 2.0 in c#

The type or namespace name 'Management' does not exist in the namespace 'Microsoft.Azure' (are you missing an assembly reference?)

The run.csx file is

using System;
using Microsoft.Azure.Management.ContainerInstance.Fluent;

public static void Run(string myEventHubMessage, ILogger log)
{
    log.LogInformation($"C# Event Hub trigger function processed a message: {myEventHubMessage}");
}

and its dependencies file is function.proj

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFramework>netstandard2.0</TargetFramework>
    </PropertyGroup>  
    <ItemGroup>
        <PackageReference Include="Microsoft.Azure.Management.ContainerInstance.Fluent" Version="1.16.1" />
    </ItemGroup>
</Project>
Rajat Sharma
  • 47
  • 1
  • 15
  • 1
    I got your code working after a few tries. Have you tried deleting your function.proj and recreating it? This might trigger the nuget restore which I assume failed for you. – Thomas Oct 19 '18 at 10:01
  • Also confirmed your code works fine along with `function.proj` under the same function directory. – Jerry Liu Oct 19 '18 at 13:41

1 Answers1

0

I've tried to recreate your issue in the portal with a new function app. At first I was getting the same error, I assume because the package restore failed or didn't run in the first place. Try deleting and recreating your function.proj file.

Thomas
  • 4,030
  • 4
  • 40
  • 79