upgraded from VS2010 to VS2013 now I cannot publis

2019-03-31 21:47发布

I can publish without issues in Visual Studio 2010 but when I attempt to publish with Visual Studio 2013 I am getting this message:

The target "MSDeployPublish" does not exist in the project. \Source2\Web Projects\SubService\subservice\subservice.csproj 0 0 subservice

Can anyone tell me what I need to do to resolve this? It's happening with 2 different projects.

3条回答
唯我独甜
2楼-- · 2019-03-31 21:51

For what its worth;

I had the same issue. Fresly installed Windows 8.1 machine, only installed Visual Studio 2013 (+update1) + Azure SDK's . Create new Web Api Project boom build error -

The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

note the v10.0. This is the default fallback when no MSBuild parameter "VisualStudioVersion" has been set. Prior to VS2012 the paths to the target files were hardcoded. Other solutions for this bugs say to remove the following from your csproj which is added for backward compatibility:

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

But removing this fixes your builds but breaks the publish feature with the original posters error:

The target "MSDeployPublish" does not exist in the project

Note: I have all Azure related SDK parts installed from the web platform installer.

I have resorted to re-adding the above XML part to my csproj file but changing the 10.0 part to 12.0 (=vs2013)

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

This might break backward compatibility but finally made my Visual Studio 2013 compile the code & made the publish feature work again.

查看更多
男人必须洒脱
3楼-- · 2019-03-31 21:52

after 4 hours I found a post not directly related to this but I took a blind shot and it worked:

Install from "Web Platform Installer" I installed the "Windows Azure SDK for .Net (VS 2013)" and that worked !

查看更多
ら.Afraid
4楼-- · 2019-03-31 22:00

If you don't want to install visual studio on build server, you can use this NuGet package with portable version of the targets: https://www.nuget.org/packages/MSBuild.Microsoft.VisualStudio.Web.targets and modify your csproj file to include it like this:

<Import Project="..\packages\MSBuild.Microsoft.VisualStudio.Web.targets.12.0.1\tools\VSToolsPath\WebApplications\Microsoft.WebApplication.targets" />

Solution originally posted here: Where is MsDeployPublish located? (in my case it was already MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0).

查看更多
登录 后发表回答