Reputation: 8009
AF runtime 2.0.12332 was working locally with VS 2017. But it is automatically changed to 2.0.12353, which has issues.
How can I change to 2.0.12332 or other version that supports DI via ctor on local station?
Possible solutions if possible, but how can I achieve it?
1) support different versions locally and run specific version, or
2) un-install current version, and re-install corect version
Update
Exception caused by the lack of IoC support:
2019-03-15T01:28:45.311 [Error] Executed 'Test' (Failed, Id=6bdb0e8e-2353-4ed2-83ce-2a5288fd124d)
System.InvalidOperationException : Unable to resolve service for type 'ICar' while attempting to activate 'TestFunctions'.
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp,Type type,Type requiredBy,Boolean isDefaultParameterRequired)
at lambda_method(Closure ,IServiceProvider ,Object[] )
at Microsoft.Azure.WebJobs.Host.Executors.DefaultJobActivator.CreateInstance[T](IServiceProvider serviceProvider) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\DefaultJobActivator.cs : 42
at Microsoft.Azure.WebJobs.Host.Executors.DefaultJobActivator.CreateInstance[T](IFunctionInstanceEx functionInstance) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\DefaultJobActivator.cs : 32
at Microsoft.Azure.WebJobs.Host.Executors.ActivatorInstanceFactory`1.<>c__DisplayClass1_1.<.ctor>b__0(IFunctionInstanceEx i) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\ActivatorInstanceFactory.cs : 20
at Microsoft.Azure.WebJobs.Host.Executors.ActivatorInstanceFactory`1.Create(IFunctionInstanceEx functionInstance) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\ActivatorInstanceFactory.cs : 26
at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.CreateInstance(IFunctionInstanceEx functionInstance) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs : 44
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ParameterHelper.Initialize() at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 845
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsyncCore(IFunctionInstanceEx functionInstance,CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 116
To fix the runtime issue on Azure Functions, see Depdency Injection and Logging start failing suddently without code changes when they were working properly with Azure Functions
Upvotes: 2
Views: 4881
Reputation: 8009
To fix the runtime issue on Azure Functions, see Depdency Injection and Logging start failing suddently without code changes when they were working properly with Azure Functions
Solution 1
1 download this https://github.com/Azure/azure-functions-core-tools/releases/tag/2.4.419
2 Replace files from step 1 to below
%AppData%\..\Local\AzureFunctionsTools\Releases\2.18.4\cli
2.18.4
might be different from your current folder. Check this to see your current folder
1 Download and extract the latest x64 1.x release from here https://github.com/Azure/azure-functions-core-tools/releases
2 Right click on your project Properties -> Debug
3 Change Launch to Executable, and put the path for the downloaded x64 func.exe
4 set Application arguments to host start
5 F5
Upvotes: 3