8

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.

Community
  • 1
  • 1
FetFrumos
  • 5,388
  • 8
  • 60
  • 98

7 Answers7

32

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.

keithl8041
  • 2,383
  • 20
  • 27
9

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

Filimindji
  • 1,453
  • 1
  • 16
  • 23
  • 1
    Had to do the same after I pulled the solution from git and ran into this issue. No need to run as admin or restart VS for me. – Vidar Aug 08 '16 at 09:04
  • Run VS 2015 with admin rights. Reinstall package Update-Package -Id Microsoft.Web.WebJobs.Publish –reinstall Then start VS normally and publish. – Michael Chudinov Sep 07 '17 at 13:56
  • Had to do the same - looking in the console output, there were elevation errors in the powershell scripts which was causing failures. Removing the package and re-running under admin fixed it right up. +1 – Katstevens Nov 05 '17 at 08:01
4

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 ;)

Vinney Kelly
  • 4,975
  • 1
  • 25
  • 31
2

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

  • This is the exact solution even if we are getting same error after adding lines to csproj. Deleting Webjob.Publish.Settings.JSON solved my problem. Thank you – Dimuth Lochana Aug 28 '19 at 09:12
0

I ran the visual studio 2015 with administrator rights. It is work for me.

FetFrumos
  • 5,388
  • 8
  • 60
  • 98
0

Just wanted to let you know that simple package update did the trick for me.

Klemikaze
  • 369
  • 6
  • 15
0

I got this error in a project with a project.json for the nuget packages.

When I removed the project.json and used the packages.config everything worked fine.

Mind that I did set the ExecutionPolicy for Windows PowerShell before I tried this, (see solution of @Jon Crowell), this might be necesary too.

If anybody finds a way to solve this with a project.json please let me know!

Community
  • 1
  • 1
Marcel Wolterbeek
  • 3,367
  • 36
  • 48