question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Function App v2 referencing .NET Standard Lib (with ASP.NET Core packages): System.Private.CoreLib: Could not load file or assembly 'Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=2.0.1.0

See original GitHub issue

I have a very simple Function App v2 (with .NET Core 2.0). This Function app references a .NET Standard lib (which in turn references some ASP.NET Core packages) and uses types from that lib.

When I start the Functions host locally & try to HTTP GET an address like http://localhost:7071/api/foo I get this exception:

[28/01/2018 19:49:35] A ScriptHost error has occurred
[28/01/2018 19:49:35] Exception while executing function: Function1. FunctionApp1: The type initializer for 'FunctionApp1.Function1' threw an exception. FunctionApp1: Could not load file or assembly 'Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.

Those assemblies are all ‘there’ in the folder of the Function app.

There are some similar issues already posted, like: https://github.com/Azure/Azure-Functions/issues/625 https://github.com/Azure/azure-functions-cli/issues/253 https://github.com/Azure/azure-functions-cli/issues/335

And a related SO post: https://stackoverflow.com/questions/48039880/azure-functions-2-0-not-loading-referenced-libraries

However, none of them provide a solution or a viable work around.

Is there anything I am doing wrong here? Thanks!

You can find a simple repro here: https://github.com/ChristianWeyer/Functions-NetStandardLib_Repro

My setup: -VS 2017 15.6.0 Preview 3.0 -Azure Functions and Web Jobs Tools: 15.0.40118.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ChristianWeyercommented, Feb 7, 2018

Oh my god - yes, this did it. Thanks @cschwendtner !

Hopefully this will be fixed soon 😃

1reaction
ChristianWeyercommented, Feb 6, 2018

Thanks for this hint @cschwendtner I had this version on my machine (although I have the latest Tools extension in VS!):

Azure Functions Core Tools (1.0.7)
Function Runtime Version: 1.0.11375.0

I did npm install -g azure-functions-core-tools@core

and now I have this version:

Azure Functions Core Tools (2.0.1-beta.22)
Function Runtime Version: 2.0.11415.0

In VS I still get this: image

… and the same errors.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ASP.NET Core 3.1.0 site won't run - Could not load ...
I'm building an ASP.NET Core app, and it's stored on an Azure web service. I had just finished the tutorial on connecting to...
Read more >
asp.net mvc - NuGet Package restore failed for project ...
Based on your error message looks like you are looking for a version that no longer exists and cannot tell which Package source...
Read more >
nuget パッケージ2万件分(名前検討用)
1} OWIN server that enables OWIN-based applications to run on IIS using the ASP.NET request pipeline. Microsoft.AspNet.WebPages {3.2.3} This package contains ...
Read more >
Profile for Mutex
So, here's an acceptor that does both, and updates the IP ranges every now and then: Rust code use std::{ collections::HashSet, io, net::{IpAddr, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found