Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Nuget Package in Azure Functions project #1363

Open
yuryshev opened this issue Apr 6, 2024 · 4 comments
Open

Issue with Nuget Package in Azure Functions project #1363

yuryshev opened this issue Apr 6, 2024 · 4 comments

Comments

@yuryshev
Copy link

yuryshev commented Apr 6, 2024

Hello @JKorf ,

There is an issue with NuGet package version 9.7.0 and higher in Azure Functions projects. It generates the following error messages:

[2024-04-06T16:39:12.427Z] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
[2024-04-06T16:39:12.462Z] The 'Function1' function is in error: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

To reproduce this, create a default Azure Functions project and add the latest version of Binance.Net, then run the application.

The previous versions work well.

Thank you

@JKorf
Copy link
Owner

JKorf commented Apr 6, 2024

Hi, what target framework are you using? Seems to work for me with a dotnet6.0 isolated function

@yuryshev
Copy link
Author

yuryshev commented Apr 6, 2024

Hmm... This is strange, first I tested on .net 6 and then switched to .net8 and there was still an error. I'll try to give more context.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
  </PropertyGroup>
  <ItemGroup>
	  <PackageReference Include="Binance.Net" Version="9.8.1" />
	  <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.3.0" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>
public static class Function1
{
    [FunctionName("Function1")]
    public static async Task<IActionResult> Run(
        [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req,
        ILogger log)
    {
        return new OkResult();
    }
}

@yuryshev yuryshev closed this as completed Apr 6, 2024
@yuryshev yuryshev reopened this Apr 6, 2024
@JKorf
Copy link
Owner

JKorf commented Apr 6, 2024

So I checked this some more, seems it's only an issue when using non-isolated process. For dotnet-isolated runtime it works correctly. I would suggest switching to dotnet-isolated if possible as this is also the recommended runtime from MS.

@Steffx115
Copy link

For me this happened when i had mixed isolated/inproc usage in my code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants