Azure / azure-functions-templates

Azure functions templates for the azure portal, CLI, and VS
MIT License
341 stars 194 forks source link

Microsoft.NET.Sdk.Functions 3.0.1+ (are you missing an assembly reference?) #1220

Open michaeljdresser opened 4 years ago

michaeljdresser commented 4 years ago

Updating the package to at 3.0.1 breaks the dependencies.

Severity Code Description Project File Line Suppression State Error CS0234 The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) FunctionApp1 C:\Visual Studio Projects\FunctionApp1\FunctionApp1\Function1.cs 2 Active Error CS0234 The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) FunctionApp1 C:\Visual Studio Projects\FunctionApp1\FunctionApp1\Function1.cs 3 Active Error CS0234 The type or namespace name 'Extensions' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) FunctionApp1 C:\Visual Studio Projects\FunctionApp1\FunctionApp1\Function1.cs 4 Active Error CS0246 The type or namespace name 'FunctionNameAttribute' could not be found (are you missing a using directive or an assembly reference?)

Replicate with Vs2019

  1. Create a new Function application with a Timer function V2 or V3
  2. Update the 'Microsoft.NET.Sdk.Functions' package to at least 3.0.1

Package Dependencies pre-update: image

Package Dependencies post-update: image

Are we now supposed to install these dependencies, or is this a bug?

ak37165 commented 4 years ago

Having the same issue.

Jo212 commented 4 years ago

Had the same issue. Resolved it by installing the dependent packages mention above manually. It is really stupid.

cbfrank commented 2 years ago

have the same issue, the default template for time trigger with azure isolated mode doesn't work

amroczeK commented 2 years ago

Facing the same issue following this documented guide.

Received the following error when running func start

/Users/amroczek/Dev/Projects/Personal/AzureFunctions/AF_Docker_Container/HttpExample.cs(18,10): error CS0246: The type or namespace name 'FunctionAttribute' could not be found (are you missing a using directive or an assembly reference?) [/Users/amroczek/Dev/Projects/Personal/AzureFunctions/AF_Docker_Container/AF_Docker_Container.csproj]
/Users/amroczek/Dev/Projects/Personal/AzureFunctions/AF_Docker_Container/HttpExample.cs(18,10): error CS0246: The type or namespace name 'Function' could not be found (are you missing a using directive or an assembly reference?) [/Users/amroczek/Dev/Projects/Personal/AzureFunctions/AF_Docker_Container/AF_Docker_Container.csproj]
/Users/amroczek/Dev/Projects/Personal/AzureFunctions/AF_Docker_Container/HttpExample.cs(19,38): error CS0246: The type or namespace name 'HttpTriggerAttribute' could not be found (are you missing a using directive or an assembly reference?) [/Users/amroczek/Dev/Projects/Personal/AzureFunctions/AF_Docker_Container/AF_Docker_Container.csproj]
/Users/amroczek/Dev/Projects/Personal/AzureFunctions/AF_Docker_Container/HttpExample.cs(19,38): error CS0246: The type or namespace name 'HttpTrigger' could not be found (are you missing a using directive or an assembly reference?) [/Users/amroczek/Dev/Projects/Personal/AzureFunctions/AF_Docker_Container/AF_Docker_Container.csproj]
/Users/amroczek/Dev/Projects/Personal/AzureFunctions/AF_Docker_Container/HttpExample.cs(19,50): error CS0103: The name 'AuthorizationLevel' does not exist in the current context [/Users/amroczek/Dev/Projects/Personal/AzureFunctions/AF_Docker_Container/AF_Docker_Container.csproj]
    0 Warning(s)
    5 Error(s)

Resolved the error by adding the following to my .csproj within ItemGroup: <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.13" />

kimjamia commented 2 years ago

I was probably on the January 2022 release of VS 2022 when I created a Storage-trigger project in isolated mode. The project was missing the Microsoft.Azure.Functions.Worker.Extensions.Storage package and the FunctionAttribute was not working. I updated to v17.1 and now when I create the same kind of project, the reference is there and the attribute is working.

lgmorand commented 6 days ago

the solution above works. we had the same issue after migrating a 7.0 to a 8.0 function