2

Did not find similar here so...

The case is to create a simple webjob on azure using .net core 2.0 I downloaded many examples and all of these examples work perfectly on my local PC, but not when I download them on azure...

One of the examples I took here - webjob sample

As I said it works perfectly locally, but on azure it throws an error during initialization:

[06/12/2018 14:54:54 > c9dee2: SYS INFO] Status changed to Initializing
[06/12/2018 14:54:54 > c9dee2: SYS INFO] Run script 'run.bat' with script host - 'WindowsScriptHost'
[06/12/2018 14:54:54 > c9dee2: SYS INFO] Status changed to Running
[06/12/2018 14:54:54 > c9dee2: INFO] 
[06/12/2018 14:54:54 > c9dee2: INFO] D:\local\Temp\jobs\triggered\ccc45\hgqichl3.x1l>dotnet webjobs-core-example.dll 
[06/12/2018 14:54:54 > c9dee2: ERR ] Error:
[06/12/2018 14:54:54 > c9dee2: ERR ]   An assembly specified in the application dependencies manifest (webjobs-core-example.deps.json) was not found:
[06/12/2018 14:54:54 > c9dee2: ERR ]     package: 'Microsoft.Azure.WebJobs.Core', version: '3.0.0-beta1-10871'
[06/12/2018 14:54:54 > c9dee2: ERR ]     path: 'lib/netstandard2.0/WebJobs.dll'
[06/12/2018 14:54:54 > c9dee2: ERR ] 
[06/12/2018 14:54:54 > c9dee2: SYS INFO] Status changed to Failed
[06/12/2018 14:54:54 > c9dee2: SYS ERR ] Job failed due to exit code -2147450740

An error says that it can't find package 'Microsoft.Azure.WebJobs.Core' that is the only one that supports .net core and it is in prerelease state (the latest stable v2 - does not support core). However I did not find an info that Azure nuget packager does not support prerelease packages...

I also tried to update to the latest beta5 - same result. Another point I tried is to copy prerelease packages on my local machine and add these as references to force the build process put these dependencies near the main library. That worked but another and then another error was thrown by the Azure that it can't resolve some other dependency and I gave up.

Is there a way to get .net core app working with azure webjobs SDK? Any suggestions are appreciated. Thanks!

Prog
  • 67
  • 9

1 Answers1

0

It seems that you are missing the webjobs reference. So you could use the a <PropertyGroup> inside your .csproj file to enforce copying NuGet assemblies to the built output:

<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

After using the above code, it will show all the dll as below and I publish to azure, it works well.

enter image description here

For more details you could refer to this thread.

Joey Cai
  • 18,968
  • 1
  • 20
  • 30
  • The most interesting thing is that I was trying the same. I copied *.dll libraries one by one that had been mentioned in errors but with no success... – Prog Jun 14 '18 at 10:27
  • The most interesting thing is that I was trying the same. I copied *.dll libraries one by one that had been mentioned in errors but with no success... Current approach (all dependencies near the main one) works but I experimented a bit and figured out that my issue goes away if only 3 dependencies are near (Microsoft.Azure.WebJobs.dll, Microsoft.Azure.WebJobs.Host.dll and Newtonsoft.Json.dll). All others (there are 7 more - like Microsoft.Extensions.Configuration.Abstractions.dll or Microsoft.Extensions.Logging.dll) can be loaded with .nuget in azure without problems... – Prog Jun 14 '18 at 11:14