Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 821
FetFrumos Avatar asked Aug 29 '15 14:08

FetFrumos


4 Answers

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.

like image 171
keithl8041 Avatar answered Oct 31 '22 15:10

keithl8041


I had to remove the Nuget, restart with administrator rights, and add it again to resolve the issue.

like image 42
Filimindji Avatar answered Oct 31 '22 15:10

Filimindji


I was able to get this issue resolved simply by adding a reference to the above mentioned Microsoft.Web.WebJobs.Publish NuGet package. No additional modification of the .csproj file were necessary in my case. I'll assume that's because of improvements in the VS 2015 tooling since the question was first posted ;)

like image 31
Vinney Kelly Avatar answered Oct 31 '22 17:10

Vinney Kelly


This works for me

Step 1: Run Visual studio as an administrator

Step 2: Make sure you have the import line (mentioned above in previous comments) in .csProj file

Step 3: Delete Webjob.Publish.Settings.JSON file (as it was showing an error) and Publishing profiles

Step 4: Deploy as Azure web job

like image 2
Gopal Ramakrishnan Avatar answered Oct 31 '22 15:10

Gopal Ramakrishnan