vs2012\vs2013\vs2015碰到生成时报该错误:项目中不存在目标“GatherAllFilesToPublish”...

手头一个vs2010升级到vs2012后,web项目发布到本地目录时项目报错:“该项目中不存在目标“GatherAllFilesToPublish””

通过谷歌大神的帮助,找到了解决方法。共享之。

原文如下:If you happen to encounter the following error “The target “GatherAllFilesToPublish” does not exist in the project.” while publishing your project to local filesystem after upgrading Visual Studio 2010 projects to Visual Studio 2012, it is most likely an issue due to the upgrade process.

错误 MSB4057: 该项目中不存在目标“GatherAllFilesToPublish”

 

Error: The target “GatherAllFilesToPublish” does not exist in the project.

While in TFS environment, a comparison is made between the csproj files. It seems that the following missing lines caused the issue:

By adding back the following lines before this line will eventually solve the issue.  <ImportProject="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

Solution:

  1. Right click project –> Unload Project. It will show the project as unavailable.
  2. Right click project again, this time select Edit (project name).csproj.
  3. Look for <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  4. Add the following above the line.
  5. End result:
  6. Save and Reload project.Issue should be solved.
  7. 检查工程文件中是否存在如下情况:
  8. <PropertyGroup>
        <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
        <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
      </PropertyGroup>
      <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
      <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(Solutions.VSVersion)' == '8.0'" />
      <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="'$(Solutions.VSVersion)' == '8.0'" />

    如果是,删除最下面两行,再发布就可以了。

  9. <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(Solutions.VSVersion)' == '8.0'" />
      <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="'$(Solutions.VSVersion)' == '8.0'" />
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值