TFS 2010 is trying to run MsTest 2010 project under MSTest 2008 - visual-studio-2010

I've got a CI build set up to build my solution and run my unit tests. The solution is VS 2010. My test project targets the 4.0 framework. And the 10.0 version of the Unit Test Framework is properly referenced. If I run the tests locally in VS 2010, I have no issues. However, when I run my CI build on the TFS server (which is TFS 2010), I get an error stating:
File not found: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe
This is the MSTest for VS 2008, and it's not installed on my TFS server. I do have VS 2010 installed on my TFS server including the testing tools but TFS doesn't look for it.
My question: Why would TFS be attempting to use this version of MSTest to run the tests? I can't find this path specified anywhere in any project, solution, or configuration on the server.
The solution and related projects began life as VS 2008 projects and were migrated to VS 2010. These files were pulled into a fresh install of TFS 2010 and a new TFS project. They were not migrated from a 2008 TFS server.
Activity Log
Full Log
Thanks!

Just a follow-up on this because I eventually discovered what was causing my issue and it was not the answer given above. We were referencing a third party assertion utility kind of like "Should" called "SoftwareApproach.TestingExtensions" in this project. This dll was an older one and contained a reference to MSTest 9 (from VS 2008). Because this dll referenced MSTest 9, it was causing this error on the build server, however, the test would run locally. Frankly, not sure why it didn't complain locally as there was no binding redirect and VS 2008 is not installed.
However, updating to a build of the mentioned dll that instead referenced MSTest 10 resolved our issue on the build server.

From looking at the logs, the problem is that MSTest is running here using the wrong version because you have a legacy assembly reference.
Make sure your unit test project and any other projects being executed for test have the correct assembly reference to the new mstest assembly. I am guessing you either missed a reference or added in the new reference and forgot to remove the legacy one.
"I can't find this path specified anywhere in any project, solution, or configuration on the server."
Yeah, you wouldn't see the path anywhere- it will just exec based on what assembly is referenced into the unit test proj.

Related

Installing test runner on Visual Studio without NuGet

I recently installed XUnit and the XUnit VS runner (i.e. xunit.runner.visualstudio) on Visual Studio following the documentation. The installation process uses NuGet and on completion I can successfully see all tests in the MS Test Explorer.
However, if I start a new solution and reference all the required XUnit dll's, i.e., I want to use XUnit without using NuGet to install it, the tests never show up in MS Test Explorer (no problems seeing them in the ReSharper test explorer).
I think this has something to do with the XUnit test adapter that Visual Studio uses to find XUnit tests. It appears that NuGet somehow instructs Visual Studio to create the VisualStudioTestExplorerExtensions folder on each build putting the necessary XUnit test adapter dll's (e.g.xunit.runner.visualstudio.testadapter.dll) in that folder. The MS Test Explorer then uses this test adapter to find XUnit test (see SO Question).
When I attempt to use XUnit without NuGet, the VisualStudioTestExplorerExtensions folder never gets created on build. Adding the folder manually with all XUnit dll's in it also doesn't work. It's almost as if i need to instruct Visual Studio to look in that folder, but I can't see any obvious way of doing that.
How do I use/install XUnit without using NuGet? Or, how do I get VS to look in the `VisualStudioTestExplorerExtensions' when looking for tests?
If you want to install a test runner manually, copy all the necessary dlls to:
C:\Program Files (x86)\Microsoft Visual Studio {version}\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions
Replacing {version} with the appropriate number.
The drawback here is that this is machine wide (maybe desirable in your case), and that you can't quite as easily replicate this setup on a build server. You also will probably have to restart VS whenever you make changes to these files.

NUnit failed to load in TFS build

I’m having a "build partially succeeded" issue with this error “NUnit failed to load e:\Builds\184\CSTax\706USServices_Test\bin\Calc.Tests.dll”, but all of the unit test in this project ran and passed (all green).
Build environment
1) Using NUnit 2.6.4 and NUnit Test Adapter 2.0.0
2) TFS 2013 – upgraded from 2012
3) Visual studio 2012 and 2013 have been installed on the server
4) I did install the NUnit Test Adapter, using the Extensions and Updates in 2013 Visual Studio
5) Using build process templates from TFS 2012, even if I switch to the 2013 default build process templates I get the same error
6) I tried changing the project to copy the nunit references locally (including the test adapter), they did make it to the bin folder, but still fails
7) I used process monitor to see if I could find the failure, everything looked good, the dlls were copied from the packages folder to the bin folder and loaded.
I’m sure it has to be something in our build environment, but I do not know where to look, I need my builds to go green. Any ideas?
The issue is a bug in the NUnit 3.0 test adapter, I removed our E2E project off of the build server and all my builds went green. NUnit is looking into this bug.
You need to:
Download the NUnit test adapter: https://visualstudiogallery.msdn.microsoft.com/6ab922d0-21c0-4f06-ab5f-4ecd1fe7175d . Rename the NUnitVisualStudioTestAdapter-2.0.0.vsix to NUnitVisualStudioTestAdapter-2.0.0.zip. Unzip NUnitVisualStudioTestAdapter-2.0.0.zip.
Check in the following dlls: nunit.core.dll, nunit.core.interfaces.dll, nunit.util.dll and NUnit.VisualStudio.TestAdapter.dll into a folder in TFS Version Control.
Specify the build controller's path to custom assemblies:
Then queue a build, the NUnit test methods will be run.
Also have a check on the Enable a third-party unit framework part of this MSDN article for the details: https://msdn.microsoft.com/en-us/library/vstudio/ms253138.aspx

Visual Studio 2013 and TFS Build 2015: Devenv.exe unable to produce MSI file

We are in the process of upgrading our TFS 2013 server to TFS 2015. In that regard I have run into an issue when trying to perform an application build on a build agent with the new version, using our XAML template build script (which was created in TFS 2013).
Most of our solutions use the above-mentioned template when we build them. The solutions (sadly, still) use setup projects (.vdproj) to generate an MSI package for the application. To build the setup project, and produce an MSI, for a given application; we call the devenv.exe (in our case, it points to Visual Studio 2013) in our template build script:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe /Build "Release|Any CPU" "d:\<path_to_solution>\solution.sln" /Out c:\temp\out.log
However, on our new build agent no MSI is produced, and calling devenv.exe yields neither any output, nor any error messages. If I try to call devenv.com, however, it starts building, but still no MSI is being produced.
When things start to build using devenv.com It seems like it is completely disregarding the setup project (I have checked the build configurations, and the setup project is checked for build on the "Release|Any CPU" configuration).
I have looked at build logs, build process activity logs, and I have also tried to perform the steps manually on the build agent, but I haven't been able to find anything that could point me in the direction as to what might be causing the issue.
Does anyone have an idea what could be the reason for this? Could it be an issue with TFS Build 2015? The only difference between the old setup, and the new - as far as I can tell - is the following:
VS 2013 was installed on C: rather than D: on the new build agent, i.e. the path to devenv would be different, but that should not matter as long as the build script is looking in the right place, and finds it...
We use a different drop location than what we used for the old setup
Appreciate any help and suggestions I can get.
Problem solved, and everything is now building successfully. I did not do a good enough job of looking at the diff between the setup we had on the build agent we used for TFS Build 2013 vs. the one we set up for TFS Build 2015.
Firstly, to be able to build setup projects in VS 2013, one needs to install the Visual Studio 2013 Installer Projects extension on the build agent.
However, there are some bugs with this extension that often causes building setup projects to yield the following error message: "An error occurred while validating. HRESULT = '8000000A'". This error can be fixed by modifying the registry, as described in this SO post.
Building the setup projects using devenv.exe, however, still doesn't work. I have not been able to figure out why, yet.
Use the Vnext build in TFS 2015 to build .vdproj. You just need to add one additional build step i.e "command line" then call devenv.com to build.
Such that,
tool :
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.com
arguments :
HelloWorldTestInstaller\HelloWorldTestInstaller.vdproj /build release
This will help you.

Is Visual Studio Required to run Coded UI tests on a build server?

I have references to
using Microsoft.VisualStudio.TestTools.UITest.Extension;
using Microsoft.VisualStudio.TestTools.UITesting;
But I'm building on a server without Visual Studio installed.
My builds are failing because these dlls can't be found (their path is in the VS install directory on my local machine)
Does this mean VS is required to run these on the build server? Or can I just copy the dlls into some project folder and add them as references?
The recommended approach is to install VS on the build server and the licensing is such that you are able to do that. The team know that this is not an ideal solution but it's the only one we have today. Note that the build server images provided by Microsoft in the hosted environment (tfs.visualstudio.com) have VS2012 and VS2010 installed into them for exactly this type of reason.

TFS 2010 Build - Do I need to install Visual Studio 2010 on TFS 2010 Build Server

I have the following error on the build server for code that compiles and passes tests fine locally.
(150): The imported project
"C:\Program
Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets"
was not found. Confirm that the path
in the declaration is
correct, and that the file exists on
disk.
I've added the WebApplications folder from my local machine to the appropriate path on the build server but I'm still getting the same error on build.
I believe the recommended approach with TFS2008 was to install VS2008 in it's entirety on the build server. Is this still the case with TFS2010 and VS2010 accordingly? a.k.a Sledgehammer to crack a nut.
Pretty much, especially if you plan on using other features like MSTest. You can try just adding the targets file but you'll probably still have some missing dependencies. You could go through the whole process of fixing the dependencies as you go along but it's probably easier just to install VS 2010 and be done with it.
This blog post seems to describe a way to do what you want without having to install additional software on the build server, if all you need is the .net compilers. It does not cover C++ compiler setup.
I discovered that if you're going to do just "standard" (i realize that's open to interpretation) web apps and non-web apps (e.g. services), you can get away with installing just Visual Studio 2010 Shell, plus Visual Studio 2010 SP1 on the build server. That will get you the missing .targets files.
Since a full VS install is required for advanced features, does anyone know if the build-server-install license cost is waived?

Resources