Not working with netcoreapp2.1?
See original GitHub issueMy function app is targeting netcoreapp2.1
- is it supposed to work with that?
I’m getting the error:
[29-Oct-18 14:09:22] Error indexing method 'WebhookProcessor.Run'
[29-Oct-18 14:09:22] Microsoft.Azure.WebJobs.Host: Error indexing method 'WebhookProcessor.Run'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'cc1' to type ICC1. Make sure the parameter Type is supported by the binding. 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.).
My project file looks like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AzureFunctionsVersion>V2</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.1" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.23" />
<PackageReference Include="Willezone.Azure.WebJobs.Extensions.DependencyInjection" Version="1.0.1" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
Startup class:
using MyApp.Functions;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Hosting;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
using Willezone.Azure.WebJobs.Extensions.DependencyInjection;
[assembly: WebJobsStartup(typeof(Startup))]
namespace MyApp.Functions
{
internal class Startup : IWebJobsStartup
{
public void Configure(IWebJobsBuilder builder) =>
builder.AddDependencyInjection<ServiceProviderBuilder>();
}
internal class ServiceProviderBuilder : IServiceProviderBuilder
{
private readonly ILoggerFactory _loggerFactory;
public ServiceProviderBuilder(ILoggerFactory loggerFactory) =>
_loggerFactory = loggerFactory;
public IServiceProvider Build()
{
var services = new ServiceCollection();
services.AddTransient<ICC1, CC1>();
return services.BuildServiceProvider();
}
}
public interface ICC1
{
int MyProperty { get; set; }
}
public class CC1 : ICC1
{
public CC1()
{
MyProperty = 42;
}
public int MyProperty { get; set; }
}
}
My function Run
method:
[FunctionName("WebhookProcessor")]
public static async Task Run(
[QueueTrigger("webhooks")] CloudQueueMessage queueMessage,
[Table("webhooks")] CloudTable webhooksTable,
[Blob("webhooks", FileAccess.ReadWrite)] CloudBlobContainer webhooksContainer,
[Inject]ICC1 cc1,
ILogger logger)
{
}
I have copied Directory.Build.targets
into the folder of my project file.
Any ideas?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:22 (1 by maintainers)
Top Results From Across the Web
NU1202 Package is not compatible with netcoreapp2.1. ...
I have a .net472 framework library which I want to call from a netcoreapp2.1 api. Because I use the library in many projects...
Read more >Package Microsoft.AspNetCore.All 2.1.0 is not compatible ...
Package Microsoft.AspNetCore.All 2.1.0 is not compatible with netcoreapp2.0 General I have VS 2017, version 15.7.3. NuGet is version 4.6.0.
Read more >is not compatible with netcoreapp2.1 - Developer Community
The issue here is am not using netcoreapp2.1 but 2.0. Severity Code Description Project File Line Suppression State
Read more >Fixing issue related to Package is not compatible with ...
Fixing issue related to Package is not compatible with netcoreapp2.1, supports netstandard2.0, when using Azure DevOps (VSTS).
Read more >This version of microsoft.aspnetcore.all is only compatible ...
The most common error is: This version of Microsoft.AspNetCore.All is only compatible with the netcoreapp2.1 target framework. Even though it ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yep, changing my Azure Function project from targetting
netcoreapp2.1
tonetstandard2.0
resolved the “Make sure the parameter Type is supported by the binding.” error in the original post.No azure functions are supposed to target as follows netstandard2.0 AFAIK However even with that change I was struggling earlier today, basically DI works locally but upon upload to Azure I am continually getting a similar message to you;