Azure WebJob ResolveWebJobFiles Error

While working with Azure WebJob you may get in a weird situation where Visual Studio lets you compile but not publish your webjob.

The target “ResolveWebJobFiles” does not exist in the project.

This scenario is present if you create a C# console application and then added from NuGet the Microsoft.Web.WebJobs.Publish package. This package is required to be able to run a console application as a web job on Azure. The problem is that Nuget doesn’t play well with csproj, and this is even more try if you did it once and you updated Microsoft.Web.WebJobs.Publish. The first problem you might have is that the .csproj doesn’t add the import xml line in the project. If this is the case, you can manually add it :

<Import Project="..\packages\Microsoft.Web.WebJobs.Publish.1.0.10\tools\webjobs.targets" Condition="Exists('..\packages\Microsoft.Web.WebJobs.Publish.1.0.10\tools\webjobs.targets')" />

The second problem is that if you update the package, with Nuget, you may get two different problems. Problem A) the version doesn’t get updated, thus you get warning. Problem B) you will get an additional import, and the previous one still stay there.

In all case, you need to open in a text editor your csproj, search for Microsoft.Web.WebJobs.Publish. If it is not there, add it. If it’s there, be sure the version is right and only present once.

If you like my article, think to buy my annual book, professionally edited by a proofreader. directly from me or on Amazon. I also wrote a TypeScript book called Holistic TypeScript

2 thoughts on “Azure WebJob ResolveWebJobFiles Error

  1. Cheers mate, mine was very similar and this Microsoft.Web.WebJobs.Publish.1.0.10 messes up even more! Your sample helped and saw that “line number” lol. Mine was only one but was added at the very end of the csproj file, I had to move it up, right underneath “CodeDom” imports, and viola! Started working!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.