Why do I get the error “The target GatherAllFilesT

2019-01-16 09:25发布

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 deployment) I get the following error:

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

Can anyone tell me what I am missing?

Thanks

18条回答
我想做一个坏孩纸
2楼-- · 2019-01-16 10: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.

查看更多
我命由我不由天
3楼-- · 2019-01-16 10:07

Sayed's solution did not work in my project which was upgraded using VS2012. But this worked

查看更多
贪生不怕死
4楼-- · 2019-01-16 10:08

I've been struggling with the same problem with Visual Studio 2013 (and 2015).

The crucial fix for me was to add the VSToolsPath property setting, which was missing in my project file, for whatever reason.

I added this into the <PropertyGroup> directive:

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

As a side note: My project file is also referencing the v10.0 version of the Microsoft.WebApplication.targets file, but that seems to be okay.

查看更多
时光不老,我们不散
5楼-- · 2019-01-16 10:08

Right click the project and select Edit (project name).csproj. (e.g. Edit in notepad) Look for Add the following above the line.

13.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) Save and Reload project.

This really work for me, Thanks

查看更多
叛逆
6楼-- · 2019-01-16 10:09

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..

查看更多
地球回转人心会变
7楼-- · 2019-01-16 10:11

I had similar issue when I wanted to publish my ASP.Net application to Windows Azure. After many trial and error finally this solution worked for me. This does not need any renaming of files or any installation / reinstallation of hotfixes / patches. Here is what you have to do:

Open the ASP.Net project file (.csproj) in Wordpad / Notepad and find the line looking similar to this:

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

Replace it with line as given below:

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
查看更多
登录 后发表回答