Setting up a VSTS Build Server to do automated builds and run unit tests. Life is good, I have provisioned the VM and installed all the necessary tools required to build and test my solution. I queue a new build and watch helplessly as my build fails on the step to execute my lovely unit tests (SSDT unit tests if you must know).
This is the exception that I get:
Microsoft.Build.Exceptions.InvalidProjectFileException: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. ... Aborting test execution.
But wait, I have logged on to the build server vm and built and tested my solution manually so I know all the bits are on the machine, so what's up dude, you're ruining my day!!
The key word in the exception is "<Import>". My test project is configured to deploy a database project before executing the tests. If I unload my database project and search for 'Import' this is what I find:
Since the Visual Studio version in which the SSDT target exists is 14.0, and the test project clearly doesn't specify a version when it references the database project, I only needed to change the default VisualStudioVersion in the database project file to 14.0 rather than 11.0 for the build server to find it and run my tests. Yeehhhaa!!
Now to figure out why the Build Agent can't upload the test results to VSTS :-(
Later dudes and dudettes.