I am using TFS 2008 and VS 2010. After adding a MS Test project to my solution I started receiving following errors on the Build server.
UnitTest1.cs(5,40): error CS0234: The type or namespace name 'UnitTesting' does not exist in the namespace 'Microsoft.VisualStudio.TestTools' (are you missing an assembly reference?) UnitTest1.cs(22,17): error CS0246: The type or namespace name 'TestContext' could not be found (are you missing a using directive or an assembly reference?) UnitTest1.cs(28,16): error CS0246: The type or namespace name 'TestContext' could not be found (are you missing a using directive or an assembly reference?) UnitTest1.cs(62,10): error CS0246: The type or namespace name 'TestMethod' could not be found (are you missing a using directive or an assembly reference?) UnitTest1.cs(62,10): error CS0246: The type or namespace name 'TestMethodAttribute' could not be found (are you missing a using directive or an assembly reference?) UnitTest1.cs(12,6): error CS0246: The type or namespace name 'TestClass' could not be found (are you missing a using directive or an assembly reference?) UnitTest1.cs(12,6): error CS0246: The type or namespace name 'TestClassAttribute' could not be found (are you missing a using directive or an assembly reference?) Done executing task "Csc" -- FAILED.
I installed VS 2010 on the build server but still the same errors.
With Visual Studio 2019 and later, it's installed under the Visual Studio installation folder. For a typical default installation on Windows 10, MSBuild.exe is under the installation folder in MSBuild\Current\Bin.
Is it possible to build an application on a system if the MSBuild is not installed? If so, How? Yes, it is actually possible because the MSBuild doesn't depend on the Visual Studio of its operations. Users simply need to install the msbuild.exe file for this.
To run MSBuild at a command prompt, pass a project file to MSBuild.exe, together with the appropriate command-line options. Command-line options let you set properties, execute specific targets, and set other options that control the build process.
The problem is in your test projects. you're referencing to some assemblies which haven't been deployed to the Build Server. Also you cannot do that by simply copy and paste to GAC or working directory.
The best and easiest way to do that is installing Visual studio 2010 Agents in the build server. It's free and it can be downloaded from MS web site. By installing the agents, it will install all the required libraries for compiling and even running the MSTest projects.
You could check if you are using correct MSBuild. In my case, when I receive messages such as:
'TestMethod' could not be found
We had to be sure we are running correct MSBuild version.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe your_solution.sln /t:rebuild /t:Rebuild /clp:ErrorsOnly
That also fixes some issues with Microsoft.VisualStudio.QualityTools.UnitTestFramework
.dll
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