Why do I get the error “The target GatherAllFilesToPublish does not exist”?

前端 未结 19 1504
走了就别回头了
走了就别回头了 2020-12-07 18:21

I have recently installed the new Azure development tools for Visual Studio 2010 service pack 1. Every time that I try to publish an existing website (using file system depl

相关标签:
19条回答
  • 2020-12-07 19:01

    If editing in VS2012 (Visual Studio 2012) a VS2010 project try this. Edit the csproj file from:

    <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
    

    And change to:

    <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets" />
    
    0 讨论(0)
  • 2020-12-07 19:03

    I had the same error. Somehow this line was missing.

    <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
    

    Added it just below

    <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    

    Works fine now

    0 讨论(0)
  • 2020-12-07 19:04

    For Visual Studio 2017 - it should be added after the block in the .csproj file, use notepad and look for ".targets" to locate it...

    I created a new VS 2017 project and this is working for me (with no warnings):

      <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="'$(VSToolsPath)' != ''" />
      <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
      <Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
        <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
      </Target>
    
    0 讨论(0)
  • 2020-12-07 19:06

    This worked for me fix - gather all files to publish error

    1. Right click the project and select Edit (project name).csproj. (e.g. Edit in notepad)
    2. Look for <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    3. Add the following above the line.

      <PropertyGroup> 
       <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">13.0</VisualStudioVersion>
       <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
      </PropertyGroup>
      
    4. Save and Reload project.

    0 讨论(0)
  • 2020-12-07 19:06

    Same problem with VS2017. You can try this, it worked for me.

    1. Unload the project and Edit csproj file
    2. search the keyword "WebApplication.targets"

       <Import Project="...\WebApplications\Microsoft.WebApplication.targets" ... >
      

      COMMENT or REMOVE this line.(maybe two lines depending on "Condition")

    3. Save and Reload project

    In this step, it will prompt you to install some package about 500M...

    After that, reload project, then it works!

    I guess I just miss some components when I install VS 2017.

    Also I notice the MSBuild Path is quite different in VS2017, but maybe that's not related to the problem cuz it uses relative path in the csproj file..

    0 讨论(0)
  • 2020-12-07 19:07

    I ran into this issue with VS 2017 and I tried manually changing the csproj file as suggested here and none of the suggested fixes worked for me. I ran across this nuget package. Installing it worked for me.

    MSBuild.Microsoft.VisualStudio.Web.targets

    0 讨论(0)
提交回复
热议问题