Search code examples
c#azure-functionsvisual-studio-mac

Azure Functions Mac - Wrong Host Version


I am trying to debug an Azure functions project on my Mac using Visual Studio Mac.

I have updated my core tools to version 2.0.3. If I type func at my terminal, I can see I updated to the latest version.

                  %%%%%%
                 %%%%%%
            @   %%%%%%    @
          @@   %%%%%%      @@
       @@@    %%%%%%%%%%%    @@@
     @@      %%%%%%%%%%        @@
       @@         %%%%       @@
         @@      %%%       @@
           @@    %%      @@
                %%
                %

Azure Functions Core Tools (2.0.3)
Function Runtime Version: 2.0.12115.0

You can also see the runtime version is 2.0.12115.0.

However when I debug using Visual Studio Mac, I get a runtime error:

Hosting environment: Production Now listening on: http://0.0.0.0:7071 Application started. Press Ctrl+C to shut down. [09/10/2018 20:30:53] Reading host configuration file 'xxxxx/bin/Debug/netstandard2.0/host.json' [09/10/2018 20:30:53] Host configuration file read: [09/10/2018 20:30:53] {} [09/10/2018 20:30:53] Starting Host (HostId=xxxxx, InstanceId=0ef8b0eb-215d-4d08-9945-6dd50c8094c7, Version=2.0.11933.0, ProcessId=22941, AppDomainId=1, Debug=False, ConsecutiveErrors=0, StartupCount=1, FunctionsExtensionVersion=) Function host is not running. Press any to continue....[09/10/2018 20:30:58] A ScriptHost error has occurred [09/10/2018 20:30:58] System.Private.CoreLib: Could not load type 'Microsoft.Azure.WebJobs.Hosting.IWebJobsStartup' from assembly 'Microsoft.Azure.WebJobs.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'.

Notice the runtime version is Version=2.0.11933.0.

There must be a way to tell visual studio where the location of the Azure-Functions-Core tools is installed or can I at least copy my 2.0.3 installation to where Visual Studio is executing from, where ever that is.


Solution

  • Visual Studio for Mac currently needs to be updated for every Functions CLI release. It unfortunately does not support being configured with a version of the Functions CLI installed on the machine (and this has been problematic for a lot of people).

    The next VS Mac update should reference the latest Functions CLI and I believe an update is planned to allow it to independently update the version of the CLI it uses without requiring a full VS update.