Azure / azure-functions-vs-build-sdk

MSBuild task for Azure Functions
MIT License
99 stars 66 forks source link

[BUG] Error in Functions SDK 3.0.9 : TimerTriggerAttribute could not be found #470

Closed TechWatching closed 3 years ago

TechWatching commented 4 years ago

Describe the bug When upgrading to Microsoft.NET.Sdk.Functions 3.0.9, the following error occurs: The type or namespace name 'TimerTriggerAttribute' could not be found (are you missing a using directive or an assembly reference?)

The concerned code is the following :

        public async Task Run([TimerTrigger("0 */5 * * * *", RunOnStartup = true)]TimerInfo myTimer,
           [DurableClient] IDurableOrchestrationClient starter,
           ILogger log)

It works fine in 3.0.8.

brettsam commented 4 years ago

@TechWatching -- could you share your entire csproj file?

FYI -- @vijayrkn

TechWatching commented 4 years ago

Yes sure

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <AzureFunctionsVersion>v3</AzureFunctionsVersion>
    <ProjectGuid>047704EB-54D9-4904-9441-881EAAD0CC66</ProjectGuid>
    <Nullable>enable</Nullable>
    <WarningsAsErrors>nullable</WarningsAsErrors>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Dapper" Version="2.0.35" />
    <PackageReference Include="Microsoft.Azure.Cosmos" Version="3.12.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.3.0" />
    <PackageReference Include="Microsoft.Data.SqlClient" Version="2.0.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.8" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.9" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>
Sonic3R commented 4 years ago

I had similar issue but with HttpTrigger but I solved with Microsoft.Azure.WebJobs.Extensions.Http nuget package added in csproj

anthonychu commented 3 years ago

@TechWatching Can you please let us know if this is still an issue for you?

TechWatching commented 3 years ago

No it is fine since there was another version of the functions SDK to which we upgraded our code to. I am closing the issue. Thanks.

PriyaDhiv commented 2 years ago

@TechWatching I am getting the same issue after upgrading the .net core version to 3.1. How this got resolved in your side? can you guide me on this.

TechWatching commented 2 years ago

@TechWatching I am getting the same issue after upgrading the .net core version to 3.1. How this got resolved in your side? can you guide me on this.

Just by using a previous version of the SDK if I remember correctly

Candelit commented 1 year ago

I have 3.1, I get the same issue.... Any solution to it?