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.
You just have to play with it at the command line. If you can get it working there you will have the "command" required to work from any CI server. That’s about the best I can offer, that’s what I had to do.
It will be specialized according to your individual project and environment. Not the sort of thing you can get from “book learning”. run the build, examine the errorlog, reconfigure accordingly, and repeat until it's error free.
For me, this was because MSBuild doesn't correctly set the environment variables it requires to find the project imports.
When you open a visual studio command prompt, the PATH etc. gets set up for the subsequent MSBuild call.
In Bamboo I avoid using MSBuild and use a script such as;
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat"
msbuild /p:Configuration=Debug /p:Platform="x86" myproject.vcxproj
Used to see errors like this often.
First, is the C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets file located in that path on the bamboo server where the build is executing? Is it located on D: or E: instead? (lots of server dudes want to reserve C: for the OS and make you install your build stuff on a different drive which is a really good idea for performance and update management).
Is the path properly quoted (spaces = bad in pathnames, just sayin...)
In general in bamboo, MSBuild fails on good code for one of these reasons:
Look for things like: you haven't saved your targets file to the repository (though it exists in your local copy)
You haven't added the targets file to one of the build files (and therefore it gets excluded even though it exists in the repository).
Another variation is that you have it pointing one place in visual studio but that location doesn't exist in the repository.
My experience with msbuild is that it behaves very differently from the IDE. There are a lot of things that the IDE does for you. Yes, in case you didn't know, Microsoft thinks it's your mother. "Oh here honey, I know what you meant to do. Let me tidy that up for you".
Which is convenient until such time as you try to do a command line build. Don't assume the command line build will work the same way. People will tell you that it will, and they will mostly be wrong.
If you haven't done it already you'll probably have to configure your build files for bamboo and have your local settings different. This can make things confusing but your developer laptop and the bamboo server (assuming you have one) probably aren't cut from the same disk image. And once you do that, don't mess it up by checking in your local settings on top of the bamboo configuration in the repository.
Hey there, Data Center community! I'm Martyna Wojtas and I am the Product Manager for Bamboo Data Center. I’m excited to share that Bamboo 9.0 is now available. We purpose-built this platform to help...