Azure / azure-functions-dotnet-extensions

Azure Functions .NET extensions
MIT License
75 stars 41 forks source link

Could not load type 'Microsoft.Azure.WebJobs.Hosting.IWebJobsStartup2' #54

Open afetter opened 3 years ago

afetter commented 3 years ago

When I install azure-functions-dotnet-extensions to be able to do a Startup class.

The error i got is:

System.Private.CoreLib: Could not load type 'Microsoft.Azure.WebJobs.Hosting.IWebJobsStartup2' from assembly 'Microsoft.Azure.WebJobs.Host, Version=3.0.17.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

But the project reference is poiting to 3.0.18.0.

image

I'm having this problem on mac.

sowmini commented 3 years ago

Facing the same issue on Mac.

System.Private.CoreLib: Could not load type 'Microsoft.Azure.WebJobs.Hosting.IWebJobsStartup2' from assembly 'Microsoft.Azure.WebJobs.Host, Version=3.0.17.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

Project reference pointing to 3.0.22.

[

Screen Shot 2020-10-08 at 1 52 24 PM

](url)

afetter commented 3 years ago

I tested the exact same code on Windows 10 and it works fine. Also, I publish it to azure, and it works as well.

sowmini commented 3 years ago

I was able to fix the issue after downgrading the 'Azure.Functions.Extensions' package to 1.0.0. Give it a shot!

viniciuschiele commented 3 years ago

I'm also facing this issue on mac, I have installed Azure Functions Core Tools version 3.0.2931.

It does work when I run func start in the terminal.

abjoseph commented 3 years ago

I can confirm that this is NOT only occuring on Mac, I'm facing this issue on Windows 10, using both Visual Studio 2019 and VSCode. Additionally, VSCode fails silently and doesn't even show the error.

I can confirm that this bug was introduce in version 1.1.0 of Microsoft.Azure.Functions.Extensions and that downgrading to 1.0.0 removes the issue.

wterpstra commented 3 years ago

Is there any other workaround than downgrading Microsoft.Azure.Functions.Extensions from 1.1.0 to 1.0.0? I need to be able to modify the IConfigurationBuilder and access my configuration from my Startup class which is not possible with 1.0.0.

aandino-dev commented 3 years ago

Hi @wterpstra

I only have the issue running from Visual Studio. The terminal and Visual Studio are giving me distinct versions. From terminal no issues running funct start

From Visual Studio

Azure Functions Core Tools (3.0.2358 Commit hash: d6d66f19ea30fda5fbfe068fc22bc126f0a74168) Function Runtime Version: 3.0.13159.0

Terminal

Azure Functions Core Tools Core Tools Version: 3.0.2996 Commit hash: c54cdc36323e9543ba11fb61dd107616e9022bba Function Runtime Version: 3.0.14916.0

rochapablo commented 3 years ago

Downgrade to 1.0.0 it did work.

chrizzo84 commented 3 years ago

I only have that error when trying to debug in VS for Mac => When starting with "func start" in Terminal it is working fine with 1.1.0. When downgrading to 1.0.0 it is also working in VS for Mac.

realrubberduckdev commented 3 years ago

I just installed the latest azure-functions-core-tools and I do not get this load error anymore.

npm install -g azure-functions-core-tools@3
func --version
3.0.2996
prashanthsarma commented 3 years ago

For me npm install didn't work as the VStudio Mac was still using files from following folder /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/AddIns/MonoDevelop.AzureFunctions/azure-functions-cli VSMac would show the version as: Azure Functions Core Tools (3.0.2358 Commit hash: d6d66f19ea30fda5fbfe068fc22bc126f0a74168) Function Runtime Version: 3.0.13159.0

The normal func start with npm had version as: Core Tools Version: 3.0.3160 Commit hash: 00aa7f43cc5c5f15241b5e6e5363256f19ceb990 Function Runtime Version: 3.0.14916.0

So, I manually duplicated the folder for falling back and copied new dlls from the npm or homebrew install at /usr/local/lib/node_modules/azure-functions-core-tools/bin to the Visual Studio.app folder mentioned above

I have no idea of compatibility with any other VS mac integrations

Glorfindel83 commented 3 years ago

A colleague of mine had this issue as well (while it was working fine on my Mac); it turns out it's possible to update the Core Tools used by Visual Studio for Mac by updating the list of templates you have when creating a new Azure Function in your solution/project. Credits to Stack Overflow user Matt Ward here.

rhythmnewt commented 3 years ago

I can confirm after running into the same problem that Core Tools update from within Visual Studio for Mac (v8) solved it for me. It was not very obvious how to do the update.

You have to create a new project and select Azure Functions as project type then on the next screen "Configure your Azure Functions Project" there will be a small "refresh" icon under all the trigger templates. That's the button that will install and update all the latest required bits.

camarandei commented 3 years ago

In my case (Visual Studio, Version 16.9.4, Windows 10) I have solved this problem by renaming the folder 3.4.1 (I couldn't remove it) from the path: C:\Users[User]\AppData\Local\AzureFunctionsTools\Releases . Then next time I have started my azure functions project, a new folder(3.18.0) was created on that path.

JRyGithub commented 3 years ago

In my case did as @rhythmnewt did above. I created a new project, when selecting the project type I clicked update templates. Then closed the project reopened my actual project and I was golden!

DureSameen commented 2 years ago

I am on mac, I am facing same issue.

I have installed 3.~ latest version of azure-functions-core-tools.

brew tap azure/functions brew install azure-functions-core-tools@3 brew link --overwrite azure-functions-core-tools@3

and it gives me this message

Warning: azure/functions/azure-functions-core-tools@3 3.0.3904 is already installed and up-to-date.

But when i run visual studio for mac 2019 and 2022 both are showing Azure Functions Core Tools (3.0.2358 )