locked
error MSB4019 : "Microsoft.WebApplication.targets" was not found RRS feed

  • Question

  • Hello,

    i tried to build our Webproject with the TFS 2010, i created a build definition and started the build. At the end i get an error:


    error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

     

    That is the one error in the BuildLog.txt

     

    Has someone a solution??

    Monday, April 19, 2010 10:32 AM

Answers

  • Hi kernel64,

           When you install VS, you need to explicitly install the Web Application Project support on your build machine, not the default VS installation options.

    If you have any concern, please feel free to post here!

    Best Regards,

    Cathy Kong

     

    Thursday, April 22, 2010 2:36 AM
    Moderator
  • We happened to have someone from Microsoft at our office today and he basically said that you should install VS2010 on to you Build Agent machines if you develope something in VS2010 and that copying the required files as suggested in your second link above is not the practice that should be followed.

    I had just assumed that microsoft would install everything a build server needs that its main tool for development requires.

    Monday, April 26, 2010 3:02 PM

All replies

  • I just found this solution for older versions:

     

    http://www.cynotwhynot.com/blog/post/MSBuild-missing-MicrosoftWebApplicationtargets.aspx

     

    Why is the file not existing in the TFS 2010 ??

    Now i copied an older version of this file from the .NET 3.5 (v.9) to the target directory.


     

    Monday, April 19, 2010 10:43 AM
  • Hi kernel64,

           When you install VS, you need to explicitly install the Web Application Project support on your build machine, not the default VS installation options.

    If you have any concern, please feel free to post here!

    Best Regards,

    Cathy Kong

     

    Thursday, April 22, 2010 2:36 AM
    Moderator
  • Cathy

    I have the same issue but i want to confirm exactly what you are saying as it does not make sense.

    Are you saying that you have to install additional components from the VS installation disk onto the Build server which has had the build software installed to actually carry out a build? Why are they not packaged with the Build installation in the first place?

    Friday, April 23, 2010 8:49 AM
  • Hi,

    If you've received this error, it usually means that the targets file can not be found/identified by the current versiuon of visual studio....

    I usually receive this error when attempting to import a .NET 3.5 project into a .NET 2.0 solution.

    To tackle this particular scenario, you will need to open the project file (.csproj).... and if you wish to make the project .NET 2.0 ready, you will need to find the following line (specific to 3.0/3.5)...

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


    and replace with...

    <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
    Hope it helps! If you have any concern, please feel free to let me know!
    Best Regards,
    Cathy Kong
    Monday, April 26, 2010 1:43 AM
    Moderator
  • I already have the <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

    Where I guess the problem lies with this is the import of <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

     

     

     

    $(MSBuildExtensionsPath32) maps for me, as it does to Kernal64 it seems, to "C:\Program Files (x86)\MSBuild" but concatenating that path with the remainder above the file does not exist on the build server however it does on my dev machine which has VS2010 RTM.

    Monday, April 26, 2010 9:27 AM
  • Hi

     Is your issue solved?

     For more information, you can refer to

    http://social.msdn.microsoft.com/Forums/en/msbuild/thread/4c8249db-85ad-4356-9313-5d47411f1a1a

    http://myvstsblog.com/vs2010/msb4019-error-on-newly-built-tfs-2010-beta-2-build-server/

    and Derik 'blog

     

    Hope it helps! If you have any concern, please feel free to let me know!

    Best Regards

    Cathy Kong

     

    Monday, April 26, 2010 2:05 PM
    Moderator
  • We happened to have someone from Microsoft at our office today and he basically said that you should install VS2010 on to you Build Agent machines if you develope something in VS2010 and that copying the required files as suggested in your second link above is not the practice that should be followed.

    I had just assumed that microsoft would install everything a build server needs that its main tool for development requires.

    Monday, April 26, 2010 3:02 PM
  • How do I install it explicitly?  

    When I run VS2010 install I have selected the option for Visual Web Developer, but in that tree view I don't see additional options to install Web Application Projects.  Is it a separate install, do you have a link if it is?

    I looked in my MSDN subscription for an install and I could not find one. 

    I also went to the web and searched and I could not find one. 

    I have broken build that's related to this problem.  

    Grateful for any information you can give me. 

    Install option might be right in front of me but I definitely can can't find them. 

     

    -Gabe

    Thursday, June 10, 2010 9:56 PM
  • We have a standard installation for our developer machines for Visual Studio 2010. Basically we have installed identically onto our build machine to ensure everything (languages etc) that we code in is there available on the build machine. That is what we were instructed to do by our visiting Microsoft representative and Cathy Kong has confirmed above.
    Thursday, June 24, 2010 7:07 AM
  • I reran the VS2010 installer and added the "Visual Web Developer" , now my build server has the following  target file and the build works.

    C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets

    Thursday, August 26, 2010 2:56 PM
  • Thanks for the tip. I had the same issue on a build server where visual studio was not installed. We had a web app which was configured to use the dev web server + create deployment zip files with every build. Taking the files from WebApplications from a dev machine solved the issue.  

    I also had to change the web app's .cproj file to use MSBuildExtensionsPath instead of MSBuildExtensionsPath32. I think you will have this type of problem only if you Visual Studio is 32 bit and your build server is 64 bit. 

    Wednesday, February 16, 2011 5:23 PM
  • There is no need to install the full Visual Studio product.

    Simply install the Team Explorer Versions, it's what they're for.

    Microsoft Visual Studio Team Explorer 2008: http://www.google.co.uk/url?sa=t&source=web&cd=1&ved=0CBkQFjAA&url=http%3A%2F%2Fwww.microsoft.com%2Fdownloads%2Fen%2Fdetails.aspx%3FFamilyID%3D0ed12659-3d41-4420-bbb0-a46e51bfca86&ei=6MKLTaqTHYebhQfp_qieCw&usg=AFQjCNFJ3A6O__lFVP0YBDicO-B_h8q2Rw

    Microsoft Visual Studio Team Explorer 2010: http://www.microsoft.com/downloads/en/confirmation.aspx?FamilyID=fe4f9904-0480-4c9d-a264-02fedd78ab38

    This will result in the following folders being install respectively:

    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v9.0\WebApplications

    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications

    Cheers,

    ll

     

    • Proposed as answer by panderon Tuesday, April 19, 2011 2:57 PM
    Thursday, March 24, 2011 10:18 PM
  • I can confirm that Team Explorer fixed the issue for me as well.  No need to install the full product, but don't forget to apply SP1 after you install Team Explorer.


    Sami Rageb, Consultant - Burwood Group - burwood.com
    Tuesday, April 19, 2011 2:58 PM
  • i agree with panderon re TE fixing the bug

    strangely though I already had VS2010 ultimate installed on my TFS build machine prior so its rather silly that TFS requires the feature-challenged TE to get the job done.

    come on guys


    MickyD | http://mickyd.wordpress.com/ Help others by voting my post as 'Helpful' if you think it is so.
    Wednesday, April 20, 2011 11:01 PM
  • Better option, simply install "Microsoft Visual Studio 2010 Shell (Integrated) Redistributable Package" http://www.microsoft.com/download/en/details.aspx?id=115

     

    It includes all files needed to build visual studio applications including C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets

    • Proposed as answer by Flookami Wednesday, August 3, 2011 1:12 PM
    Wednesday, August 3, 2011 1:11 PM
  • Just edited the last line of the project (.csproj) file 

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

    to

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

     

    as I am using Visual Studio 2008

    Saturday, September 3, 2011 6:10 PM
  • I also found that replacing the Import statement for the v10.0 reference (below)

     

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


     

    with the following entries (below) will do the trick.

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

     

     

    This will allow the project to build using Visual Studio 2010 or 2008.  It will allow server builds where VS2010 is not installed since it checks for the existence of the referenced targets file before it attempts the import.  It will also allow developers running either version to continue running the project.  Running in VS2008 also requires that the ProjectToolsVersion be set to 3.5 when performing a server build or from the 2008 command line.

    I've used this solution for web services that were upgraded in preparation for a TFS 2010 migration.  I have not tried an entire web site.
    Hope this works for someone else.
    • Proposed as answer by Josh Bean Friday, November 25, 2011 8:34 PM
    • Edited by Josh Bean Friday, November 25, 2011 8:41 PM
    Friday, November 25, 2011 8:33 PM
  • Yes - this is the best option! Works great! 
    Tuesday, March 13, 2012 10:50 AM