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

Reference conflicts #4670

Closed
atifgk opened this issue Sep 18, 2020 · 11 comments
Closed

Reference conflicts #4670

atifgk opened this issue Sep 18, 2020 · 11 comments
Assignees
Labels
Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-replied-to Indicates that the team has replied to the issue reported by the customer. Do not delete. customer-reported Issue is created by anyone that is not a collaborator in the repository.

Comments

@atifgk
Copy link

atifgk commented Sep 18, 2020

Error CS1705 Assembly 'Microsoft.Bot.Builder.Integration.AspNet.Core' with identity 'Microsoft.Bot.Builder.Integration.AspNet.Core, Version=4.10.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'Microsoft.AspNetCore.Http.Abstractions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' which has a higher version than referenced assembly 'Microsoft.AspNetCore.Http.Abstractions' with identity 'Microsoft.AspNetCore.Http.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' Azure FunctionApp

Version

Microsoft.Bot.Builder.Integration.AspNet.Core, Version=4.10.3.0 with azure function

Describe the bug

Getting version conflict

Screenshots

image

@atifgk atifgk added bug Indicates an unexpected problem or an unintended behavior. needs-triage The issue has just been created and it has not been reviewed by the team. labels Sep 18, 2020
@mrivera-ms mrivera-ms removed bug Indicates an unexpected problem or an unintended behavior. needs-triage The issue has just been created and it has not been reviewed by the team. labels Sep 18, 2020
@EricDahlvang
Copy link
Member

Hi @atifgk

I believe you will need to manually add a reference to Microsoft.AspNetCore.HttpAbstractions 3.1.0 in order to overcome this. I assume your project is targeting net core 3.1?

@EricDahlvang EricDahlvang added Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-replied-to Indicates that the team has replied to the issue reported by the customer. Do not delete. customer-reported Issue is created by anyone that is not a collaborator in the repository. labels Sep 18, 2020
@atifgk
Copy link
Author

atifgk commented Sep 19, 2020

Hi @EricDahlvang thanks for reply. yes i'm using asp.net core 3.1 version. in nuget only Microsoft.AspNetCore.HttpAbstractions 2.2.0 available. can you please guide how i can install 3.1.0? thanks

@atifgk
Copy link
Author

atifgk commented Sep 19, 2020

@Jawvig
Copy link

Jawvig commented Sep 20, 2020

I get the same issue. Steps to reproduce:

  1. Create an Azure Function app in VS 2019
  2. Add the "Microsoft.Bot.Builder.Integration.AspNet.Core" 4.10.3 package
  3. Replace the contents of the function class with the following:
    public class Function1
    {
        private readonly IBotFrameworkHttpAdapter _adapter;
        private readonly IBot _bot;

        public Function1(IBotFrameworkHttpAdapter adapter, IBot bot)
        {
            _adapter = adapter;
            _bot = bot;
        }

        [FunctionName("Function1")]
        public async Task<IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
            ILogger log)
        {
            return await _adapter.ProcessAsync(null, null, _bot);
        }
    }
  1. Compile the project

Here's what the .NET Core 3.1 version Microsoft.Bot.Builder.Integration.AspNet.Core assembly is referencing:
image
i.e. version 3.1.0.0, which, as @atifgk says, is not available on NuGet
This clashes with the version of the Microsoft.AspNetCore.Http.Abstractions package as referenced (indirectly) by the Microsoft.Net.Sdk.Functions 3.0.7 (and 3.0.9, at least) package, which is version 2.1.0.

I think there's a workaround as the .NET Standard 2.0 package references the following:
image
i.e. version 2.1.0.0
Hence the workaround ought to be indirectly referencing the package through a .NET standard library.

@EricDahlvang
Copy link
Member

I apologize for my confusion in the above response. Looking into this more, Microsoft.AspNetCore.HttpAbstractions is actually provided for a 3.1 project via a FrameworkReference:

  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>

Please add this to your .csproj file, and let us know how it goes.

@atifgk
Copy link
Author

atifgk commented Sep 22, 2020

Hi @EricDahlvang ,
Thanks for reply. I tried your solution it solved that error but now getting other error.

System.Private.CoreLib: Exception while executing function: BotMessagesHandler. Microsoft.Bot.Connector: Could not load file or assembly 'System.IdentityModel.Tokens.Jwt, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

I tried installing System.IdentityModel.Tokens.Jwt, Version=5.6.0.0 but no success

@EricDahlvang
Copy link
Member

@atifgk can you share the project?

@atifgk
Copy link
Author

atifgk commented Sep 22, 2020

@EricDahlvang please find project in attachment

SampleProject.zip

@atifgk
Copy link
Author

atifgk commented Sep 22, 2020

it work fine if i use Microsoft.Bot.Builder.Integration.AspNet.Core" 4.6.0 version

<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.10.3" />

@EricDahlvang
Copy link
Member

Well, this is odd. Adding _FunctionsSkipCleanOutput to the .csproj fixes the System.IdentityModel.Tokens.Jwt load issue:

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AzureFunctionsVersion>v3</AzureFunctionsVersion>
    <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
  </PropertyGroup>

More information about this can be found here:
Azure/azure-functions-vs-build-sdk#397
and
Azure/azure-functions-host#5894

@atifgk
Copy link
Author

atifgk commented Sep 22, 2020

Thanks @EricDahlvang its working now with your trick :)

@atifgk atifgk closed this as completed Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-replied-to Indicates that the team has replied to the issue reported by the customer. Do not delete. customer-reported Issue is created by anyone that is not a collaborator in the repository.
Projects
None yet
Development

No branches or pull requests

4 participants