Hi,
Using dotnet core 2.0, while writing some tests that reference a project with a nuget dependency to:
AWSSDK.Extensions.NETCore.Setup (3.3.4),
I get the error that the Microsoft.Extensions.Logging.Abstractions v1.0 assembly cannot be found (callstack further below).
I had a quick look to your code and in my opinion (could be wrong), it might be missing a line in the nuspec (the last dependency line):
<dependencies>
<group targetFramework="netstandard1.3">
<dependency id="AWSSDK.Core" version="[3.3.13.3, 3.4)" />
<dependency id="Microsoft.Extensions.Configuration.Abstractions" version="1.0.2" />
<dependency id="Microsoft.Extensions.DependencyInjection.Abstractions" version="1.0.2" />
<dependency id="Microsoft.Extensions.Logging.Abstractions" version="1.0.0" />
</group>
</dependencies>
After adding this line, recreating the package manually, overwriting the existing version and rebuilding the project, my code simply works.
Important: it also works if I just add manually the logging package with a v1.0 to my project, without modifying aws-sdk-net at all.
Important2: it also works if I downgrade to:
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.3.1" />
instead of 3.3.4 that is the current one.
I should not get an error describing a missing assembly when running a project test.
Possible solution above.
System.IO.FileNotFoundException : Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
at Amazon.Extensions.NETCore.Setup.ClientFactory.CreateServiceClient(IServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor
2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor
2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass22_0.
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetServiceT
Possible solution above.
Developing a lambda that makes use of SQS and while writing some tests I got this issue.
dotnet --info
:Product Information:
Version: 2.1.4
Commit SHA-1 hash: 5e8add2190
Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.4\
Microsoft .NET Core Shared Framework Host
Version : 2.0.5
Build : 17373eb129b3b05aa18ece963f8795d65ef8ea54
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
</PropertyGroup>
<ItemGroup>
<None Remove="appSettings.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="1.0.0" />
<PackageReference Include="Amazon.Lambda.Serialization.Json" Version="1.1.0" />
<PackageReference Include="Amazon.Lambda.KinesisEvents" Version="1.0.1" />
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.3.4" />
<PackageReference Include="AWSSDK.SQS" Version="3.3.3.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.1" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Amazon.Lambda.Tools" Version="2.1.1" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="appSettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Bankrekt.Scheduler.Shared\Bankrekt.Scheduler.Shared.csproj" />
</ItemGroup>
</Project>
This is probably because your project is targeting 2.0 and is pulling 2.0 of Microsoft.Extensions.Logging.Abstractions, but NETCore.Setup is looking for 1.0 binaries. We'll take a look at this.
Good catch about the missing reference. I'm making that change and will get an update out soon.
Version 3.3.3.5 was released thanks for letting us know about the issue.
I am seeing similar kind of issue with dotnet core 3.0 Any clue about it?
I also get the same problem when building for dotnet core 3.0
Most helpful comment
I am seeing similar kind of issue with dotnet core 3.0 Any clue about it?