ASP.NET Webdeploy Error; AddScheduledJob does not exist in the project

I have an ASP.NET project with two WebJobs, one of WebJobs publishes fine, but the second fails to publish, and I get the following error message:

The target "AddScheduledJob" does not exist in the project.

Both are WebJobs that are configured to run on demand.

I'm struggling to find some explanation for this error and can't see what sets my two WebJobs apart. Has anyone come across this?

Edited

In the end, I found the problem thanks to the fact that David Ebbo pointed me in the right direction. I found that I had two import lines in the .csproj file of one of my WebJobs projects:

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

After removing the first one, everything worked fine. I don’t know how this happened, but you can only assume that something went wrong when I updated the NuGet package.

+5
source share
2 answers

I had a similar problem when I had existing WebJob SDK projects on an ASP.NET site and I added a new one. The new one used a newer version of the Microsoft.Web.WebJobs.Publish package.

I used the "Add an existing project as Azure WebJob" stream to add it, and then I noticed in the ASP.NET project that there are now two Imports:

  <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')" /> <Import Project="..\packages\Microsoft.Web.WebJobs.Publish.1.1.0\tools\webjobs.targets" Condition="Exists('..\packages\Microsoft.Web.WebJobs.Publish.1.1.0\tools\webjobs.targets')" /> 

I just uninstalled Import with an older version , and that took care of that.

+5
source

In the WebJob project, delete the webjob-publish-settings.json file, also remove webjobs-list.json from your WebAPI project.

Now, in the WebAPI project, right-click> Add> Existing Project as Azure Web Job. This will recreate the webjob-publish-settings.json and webjobs-list.json files and fix the problem.

+1
source

Source: https://habr.com/ru/post/1272772/


All Articles