2
votes

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!

1
Please start with this guidance to isolate and get WebJobs out of the equation.David Ebbo
The error above was taken from Kudu WebJobs Dashboard... Are you pointing to something specific?Prog
Isolating as suggested can helpDavid Ebbo

1 Answers

0
votes

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.