3

I created a small project which works fine uploaded to Azure as a WebJob. I then added a NuGet reference to MailKit so that it would send emails. From my computer, this works fine and sends emails.

When I uploaded the email enabled project, the following error occurred

[05/31/2018 14:04:05 > c30776: ERR ]   An assembly specified in the application dependencies manifest (myProject.deps.json) was not found:
[05/31/2018 14:04:05 > c30776: ERR ]     package: 'MailKit', version: '2.0.4'
[05/31/2018 14:04:05 > c30776: ERR ]     path: 'lib/netstandard2.0/MailKit.dll'

Which I'm guessing is because the MailKit NuGet package is not installed/available on the Azure server. How do I reference MailKit in my Azure WebJob? Am I supposed to add the package reference somewhere else in my Azure or do I need to reference a central instanct of MailKit?

Dave
  • 253
  • 2
  • 12

1 Answers1

0

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

<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

Then you will get all the dll you needed as following: enter image description here

For more details you could refer to this article.

Also you could publish your netcore console to Folder when publish to azure and upload the zip folder to azure. It can include all the reference and json files you needed.

And then put the whole folder to zip folder and upload to azure as webjobs.

enter image description here

Joey Cai
  • 18,968
  • 1
  • 20
  • 30