My VS2010 solution has a test project in it. The unit tests themselves reference the following namespace:
using Microsoft.VisualStudio.TestTools.UnitTesting;
which is accessed via the following assembly on my PC:
Assembly Microsoft.VisualStudio.QualityTools.UnitTestFramework C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
When I build the solution on my PC I have no issues; the tests will build and run okay.
We have an intranet page which we can use to kick off builds on a build server. When I build via this page, the build fails with the following errors:
Generator.cs(3,17): error CS0234: The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
The obvious problem would be that the Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
mentioned above is not present on the build server. I thought this was would be installed with VS2010, and since the projects in my solution build .NET 4.0 targets, I would expect this to be installed on the build server.
What is the easiest way to resolve this? The build server is out of my jurisdiction and I don't particular want to log a job to get new libraries installed on to it.
You can use unit testing functionality in Visual Studio to test an MSBuild custom task before distribution to ensure the correctness of the code.
On the Create a new project page, type unit test into the search box. Select the project template for the test framework that you want to use, for example MSTest Test Project or NUnit Test Project, and then select Next. On the Configure your new project page, enter a name for your project, and then select Create.
Follow these steps to add the test project: Step 1: Right-click on the project solution and select the Add -> New Project option. Step 2: Select NUnit test project (. NET Core) and click Next.
The .UnitTestFramework.dll sits in C:\Program Files... folder and you have a reference to it.
After that you can checkin your changes (make sure the Source/Binaries folder is checked in) and build the solution. When build server builds the solution it should get the dll from the source control.
The specific answer for me and a Visual Studio 2010 solution was:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With