We recently ran into a blocking issue when deploying a custom .net core Azure WebJob:
Error MSB4057: The target "MSDeployPublish" does not exist in the project.
The project would build successfully, but the deployment would fail.
- I made sure that the solution was running as Administrator.
- I made sure that Microsoft.Web.WebJobs.Publish.1.1.0 NuGet package was installed and applied correctly.
- I even removed and re-applied the NuGet package.
But the solution would not deploy.
I found Rhizohm's blog post which recommends a manual edit to your webjob's CSPROJ file to resolve the issue. it appears that this issue has been around since at least Visual Studio 2015.
I resolved my publish issue by manually adding the following to the bottom of your webjob's CSPROJ file:
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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')" />
Upon Further Review
Earlier this month, we upgraded our solutions from .net core 1.1 to .net core 2.0, and ran into this annoying bug with machine.config & System.Tuple reference. We ran into an reference error for System.Tuple when we tried to run EF database-update commands, but the solution could not build/publish with it in. We weren' crazy about the idea of manually editing the machine.config during EF updates & build/deployments - so we decided to rebuild our solution as a brand new .net core 2.0 solution (not our existing one that was upgraded from .net core 1.0 beta, 1.0 RTM and 1.1 RTM). That resolved the strange System.Tuple error.... BUT that is when we lost the Import Project node for Microsoft.Web.WebJobs.Publish in our webjob's project file.