1

The target "MSDeployPublish" does not exist in the project

I see people refer to this link as it would give the solution to my problem. I read the complete thread and tried every single idea given there. Nothing worked. I also use VS 2015 Community and not VS 2013.

I am trying to publish a Web API through VS 2015 Community. I have done it before, but this time it seems to not be working.

I got the publish settings from IIS on the server and the validation on the connection works fine.

When I do the publish I get this error:

The target "MSDeployPublish" does not exist in the project

I tried several things, but the most mentioned one is (re)installing the Microsoft.Web.WebJobs.Publish NuGet Package and check the CSPROJ file for these two lines:

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

You already guessed that this isn't working in my case (otherwise I wouldn't post here).

The first thing I notice is the version 10.0. I backtracked the path and there isn't a version 10.0 on my disk. Only 12, 14 and 15. 14 seems to have the targets, so I changed the version to 14... Same error.

I tried to install several packages, checked the CSPROJ file again and nothing seems to happen. Same error over and over again (getting a bit frustrated here... )

Does anyone have another solution for this?

* UPDATE *

It seems to work on other projects. It looks like something is wrong with this particular project.

* UPDATE 2 *

I set up a FTP connection to the host, as I was trying something else. I tried to publish with the FTP, but gave almost the same error:

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

Community
  • 1
  • 1
  • Possible duplicate of [The target "MSDeployPublish" does not exist in the project](http://stackoverflow.com/questions/23634039/the-target-msdeploypublish-does-not-exist-in-the-project) – Maria Ines Parnisari May 02 '17 at 02:57
  • Whilst the second answer is correct, the issue is not fixed unless you explicitly restart the VS.NET as 2013/2015 cache the targets on startup meaning that you can follow all the steps but still get the same error, as to the install as Administrator this was not required. **Edit: 1** If this is not the answer please could you actually provide the solution! As it has worked for me, but moving branches causes the issue to reappear. – CrazeydAVE Jul 18 '17 at 13:44
  • Wasn't the answer to my problem. Maybe to something else, I don't know –  Jul 19 '17 at 03:35

2 Answers2

4

Does anyone have another solution for this?

I have encountered this error before, I resolved by following method. Not sure if it works for you, but you can try it.

First, Install Packages(Run VS as Administrator):

install-package MSBuild.Microsoft.VisualStudio.Web.targets

install-package Microsoft.Web.WebJobs.Publish

Second, Edit WebJob Project File:

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

Note:

  1. Make sure your VisualStudio is running as "Administrator", otherwise, the install.ps1 possibly throws an error when installing that package.
  2. <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> Only when the condition is null, the value of VisualStudioVersion will be set to 10.0 rather than set this value to 10.0.

Hope this can help you.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • I always run VS as admin. Like said in the original post: I don't see a v10.0 in my directory structure on the hard drive. Maybe a stupid question, but where can I find the WebJob Project file? Last: Please see also my updated original post –  May 02 '17 at 08:39
0

If anybody gets this with newer Studios, check if you have uninstalled .NET Core 3.1 and accidentally removed the whole Web Development Workload.

Lars Holm Jensen
  • 1,645
  • 1
  • 12
  • 14