“GatherAllFilesToPublish” Error in Upgraded VS2012 Projects

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.

Error: The target "GatherAllFilesToPublish" does not exist in the project.
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:

    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)MicrosoftVisualStudiov$(VisualStudioVersion)</VSToolsPath>

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


  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.
        <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
        <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)MicrosoftVisualStudiov$(VisualStudioVersion)</VSToolsPath>
  5. End result:
        <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
        <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)MicrosoftVisualStudiov$(VisualStudioVersion)</VSToolsPath>
    <Import Project="$(MSBuildToolsPath)Microsoft.CSharp.targets" />
  6. Save and Reload project.

    [adrotate banner=”1″]

Issue should be solved.

Note: This error is somewhat different from the issue caused in Windows Azure projects.

9 thoughts on ““GatherAllFilesToPublish” Error in Upgraded VS2012 Projects

  1. thank it’s work, but when i want to commit with my build test i have a error :
    C:WindowsMicrosoft.NETFramework64v4.0.30319Microsoft.Common.targets (2482): Unable to find manifest signing certificate in the certificate store.

    Any idea about this?
    Thank you again

  2. The problem with the solution you have provided is that it breaks builds on certain build servers, because it looks for the wrong version of VSTools. It seems to always want version 11.0 when building .Net 4.0 projects.

    Adding an empty target called GatherAllFilesToPublish in the .csproj file will prevent errors, but you might end up with empty directories when publishing, or all source files are also published.

    • Hi Vegard Helland,

      Thank you for your insight. Perhaps you may share your solution on how to resolve this issue since at this moment I am unable to resolve it using other methods.


      • Hi,

        After a days worth of research and work, I ended up creating a new solution with new projects and just copy the source files from the old solution.

        A few of the hacks I tried worked well, but they would break on the next Visual Studio upgrade as they all required manual editing of the .csproj file with version numbers.

        Built in publish functionality in Visual Studio is abandoned here now. We write nant or powershell scripts to do the job for us.

  3. I had this problem after moving a working WCF Service project from one computer with VS 2017 installed to another one with VS 2017 installed. Second one did not have “ASP.NET and web development” checked in VIsual Studio Installer. Checking that and restarting VS 2017 solved the problem.

  4. happend to me in VS 2019 – there were wrong filesystem path settings in the web project config file:


    (did point to vs v15)

    (same here)

    hope it helpz 🙂

Leave a Reply