Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The target "MSDeployPublish" does not exist in the project

I know there have been other references to this issue. But I didn't upgrade from one version of VS to another. I am currently using VS 2013. The project builds fine, and has even deployed successfully in the past. This is a brand new app. So it wasn't something inherited from another project. Where can I start looking? What can I post here that may be helpful for you guys to hopefully help me? It is a web api 2 site. I am using the publish command within VS2013.

like image 280
Greg P Avatar asked May 13 '14 14:05

Greg P


7 Answers

Adding the lines below to my .csproj file seems to solve the same error for me:

<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>

As part of trying to resolve the issue, I've also installed the MSBuild.Microsoft.VisualStudio.Web.targets Nuget Package. But I'm still not sure it was necessary in order to resolve the issue.

like image 131
RonyK Avatar answered Sep 29 '22 15:09

RonyK


If you get this MSB4057 error from a WebJob project using "Publish as Azure WebJob" using Visual Studio 2013/update 4 - you may need to update the NuGet package Microsoft.Web.WebJobs.Publish

Check MyWebJob\packages.config and if the version is 1.0 you need version 1.02 or higher. From the package manager console run

 Install-Package Microsoft.Web.WebJobs.Publish -Version 1.0.2
like image 25
RickAndMSFT Avatar answered Sep 29 '22 16:09

RickAndMSFT


With VS 2013 Update 4. There seems to be issues with the template of a Webjob project so that the reference to webjobs.targets is wrong, even though you've installed the Microsoft.Web.WebJobs.Publish package.

Make sure There Import statement at the bottom of of the project is correct in terms of the path, I tested twice and found it was malformed.

<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')" /> 

Also, better avoid using the below, since it binds you to a specific VS version.

<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
like image 35
Uri Golani Avatar answered Sep 29 '22 15:09

Uri Golani


FYI, same issue on VS2019, same solution:

  • Install the nuget Microsoft.Web.WebJobs.Publish
  • Install the nuget MSBuild.Microsoft.VisualStudio.Web.targets
like image 27
Bart Coppens Avatar answered Sep 29 '22 16:09

Bart Coppens


For those who are deploying a WebJob, this error might also be due to a missing webjob-publish-settings.json file (it should be located in the Properties folder of the WebJob project). Its structure should be e.g:

{
  "$schema": "http://schemastore.org/schemas/json/webjob-publish-settings.json",
  "webJobName": "MyWebJob",
  "startTime": "2017-01-27T03:00:00+00:00",
  "endTime": null,
  "jobRecurrenceFrequency": "Hour",
  "interval": 1,
  "runMode": "Scheduled",
  "is_singleton": true
}

(this is for an hourly scheduled job).

like image 41
McBodge Avatar answered Sep 29 '22 16:09

McBodge


Having just re-installed VS 2017 (15.5.6) I ran into this with one of three WCF projects. I picked through the csprojs for all three and could find no difference between them, cutting and pasting the various imports, paths etc from the working ones didn't make any difference.

Adding the nuget package MSBuild.Microsoft.VisualStudio.Web.targets (v14.0.0.3 was the latest, i.e. VS2015) has fixed the problem...for the moment. I can't believe this has gone away for good though.

like image 35
Mike Dean Avatar answered Sep 29 '22 16:09

Mike Dean


Just bumped into this exact error with VS 2015 Update 3. The latest Microsoft.Web.WebJobs.Publish was installed, and I tried unstalling and re-installing for good measure. Still didn't work but there was an error on install that I didn't see the first time around:

install.ps1 cannot be loaded because running scripts is disabled on this system.

This is something that most who have ever run a PowerShell script have run into at one time or another and easy to fix (solution is here), but the error message itself is easy to miss.

like image 24
Todd Menier Avatar answered Sep 29 '22 15:09

Todd Menier