Norbert Huurnink
Norbert Huurnink

Reputation: 1316

Azure Webjobs publish error (active directory)

When I try to publish an azure webjob, I get the following error:

An error occurred while creating the WebJob schedule: Could not load type 'Microsoft.IdentityModel.Clients.ActiveDirectory.ActiveDirectoryAuthenticationException' from assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.16.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

The same question is asked in Visual Studio 2015 Publish WebJobs Issue, but the accepted answer does not solve my case.

I tried to add the nuget package for ActiveDirectory version 2.16, but that didn't solve it either.

Upvotes: 1

Views: 670

Answers (2)

Mostafa
Mostafa

Reputation: 3302

I found the solution as i have been stuck in this error for a while.

The issue turns to be that it is a bug in Visual Studio 2015 Update 3. It uses old webjobs publishing tools even if you have newer NuGet packages.

After looking at the source of the problem in the output window, Visual Studio build tools were looking for an older webjobs publishing package ver. 1.0.3 while i have 1.0.12 on my pc.

Below screen shot shows that my csproj file contains 5 publishing packages.Everytime i deploy it checks for the first condition and uses 1.0.3 while i want the build tools to use 1.0.12!

enter image description here

The fix for this is to unload the project in Visual Studio 2015, Edit the .csproj file and delete the older NuGet publish packages from the build targets.

Rebuild, Publish, The webjob will be deployed to Azure and a scheduler will be created with no issues!

Hope this helps.

Upvotes: 1

David Ebbo
David Ebbo

Reputation: 43183

There is now a better way of scheduling WebJobs using CRON expressions, which is simpler and avoids all the Scheduler issues.

I have added a new answer to the existing question, to keep everything in context of the original answers.

See details on Visual Studio 2015 Publish WebJobs Issue

Upvotes: 1

Related Questions