FetFrumos FetFrumos - 3 months ago 355
C# Question

Azure Web Job in Visual Studio 2015 - deploy not working with error "target "MSDeployPublish" does not exist in the project."

I use Visual Studio 2015 and azure sdk 2.7.1. I created azure web job. When I run deploy I get error:

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

I created web job in Visual Studio 2013 - deploy is work. I compare the two projects(2015 and 2013) - in 2013 there is this code:

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


I put this code in my project in 2015, but deploy is not working. I saw

this question, but it does not work for me.

Answer

Using VS2015, when installing the Microsoft.Web.WebJobs.Publish NuGet package I noticed in the package console that the install.ps1 powershell script threw an error due to lack of execute permissions. On inspection it appears this script was meant to add in an import reference within the .csproj of the project I was installing to. Adding the following line to my .csproj file did the trick and fixed the above error for me;

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

Note: your package version might be different, in which case replace 1.0.6 with whatever version matches your installed package.

Note: Your solution setup may be different, in which case make sure your path to the ..\packages folder is correct.

Note: this issue occurs when you don't run VS with administrator rights.

Comments