“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:

By adding back the following lines before this line will eventually solve the issue.  <Import Project="$(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.

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

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

  1. philippe

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

    Any idea about this?
    Thank you again

    Reply
  2. Vegard Helland

    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.

    Reply
    1. Dawa Post author

      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.

      Regards,
      Dawa

      Reply
      1. Vegard Helland

        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.

        Reply

Have something to say?