Having troubles building my solution with MSTests on Bamboo
Asked by Philip van Veen:

I am totally new to bamboo. I created a plan and linked it to stash, it build successfully my project. Then in VisualStudio I added a new project to the solution file of type UnitTest and wrote couple of simple tests to cover my code and business logic. I build my changes and it run fine, commit everything to stash and my project failed to build the solution:

Error Log

```
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference:C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll /reference:C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll /reference:C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\UnitTestGUI.dll /subsystemversion:6.00 /target:library /utf8output UnitTest1.cs Properties\AssemblyInfo.cs "C:\Users\Administrator\AppData\Local\Temp\1\.NETFramework,Version=v4.5.AssemblyAttributes.cs"                UnitTest1.cs(2,17): error CS0234: The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\Users\Administrator\bamboo-home\xml-data\build-dir\GUI-DEV-JOB1\UnitTestGUI\UnitTestGUI.csproj]                UnitTest1.cs(9,10): error CS0246: The type or namespace name 'TestMethod' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Administrator\bamboo-home\xml-data\build-dir\GUI-DEV-JOB1\UnitTestGUI\UnitTestGUI.csproj]                UnitTest1.cs(9,10): error CS0246: The type or namespace name 'TestMethodAttribute' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Administrator\bamboo-home\xml-data\build-dir\GUI-DEV-JOB1\UnitTestGUI\UnitTestGUI.csproj]                UnitTest1.cs(6,6): error CS0246: The type or namespace name 'TestClass' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Administrator\bamboo-home\xml-data\build-dir\GUI-DEV-JOB1\UnitTestGUI\UnitTestGUI.csproj]                UnitTest1.cs(6,6): error CS0246: The type or namespace name 'TestClassAttribute' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Administrator\bamboo-home\xml-data\build-dir\GUI-DEV-JOB1\UnitTestGUI\UnitTestGUI.csproj]                (CoreCompile target) -&gt;                   UnitTest1.cs(2,17): error CS0234: The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\Users\Administrator\bamboo-home\xml-data\build-dir\GUI-DEV-JOB1\UnitTestGUI\UnitTestGUI.csproj]                  UnitTest1.cs(9,10): error CS0246: The type or namespace name 'TestMethod' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Administrator\bamboo-home\xml-data\build-dir\GUI-DEV-JOB1\UnitTestGUI\UnitTestGUI.csproj]                  UnitTest1.cs(9,10): error CS0246: The type or namespace name 'TestMethodAttribute' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Administrator\bamboo-home\xml-data\build-dir\GUI-DEV-JOB1\UnitTestGUI\UnitTestGUI.csproj]                  UnitTest1.cs(6,6): error CS0246: The type or namespace name 'TestClass' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Administrator\bamboo-home\xml-data\build-dir\GUI-DEV-JOB1\UnitTestGUI\UnitTestGUI.csproj]                  UnitTest1.cs(6,6): error CS0246: The type or namespace name 'TestClassAttribute' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Administrator\bamboo-home\xml-data\build-dir\GUI-DEV-JOB1\UnitTestGUI\UnitTestGUI.csproj]
```

I am not sure whats wrong? Is Bamboo not capable of having multiple projects in one solution file?

Am i doing something wrong? Or did I forget a step?

I am currently using MSBuild as builder. Do i have to install and use Visual Studio to build the plan?


Answers:
author: Jeff Kaffenberger
body: I use CodedUI Tests, so I ended up having to install VS on my build machine. I don't have your exact setup, but check out this site, which talks about copying some files over from a full install so they can be found by msbuild. <https://sparethought.wordpress.com/2011/07/12/mstest-2010-on-the-build-server-without-vs2010-installed/>

comments: author: Philip van Veen
body: thanks for the article jeff, as soon as I have some time on my hands I will try it... but I think the easiest way would be to just install VisualStudio on that machine...


author: Jeff Kaffenberger
body: This sounds more like a build machine error, not Bamboo. Can you log into your build machine and perform the build manually? Maybe the below articles will spark an idea

<http://stackoverflow.com/questions/13602508/where-to-find-microsoft-visualstudio-testtools-unittesting-missing-dll>

<http://stackoverflow.com/questions/20259076/type-or-namespace-name-visualstudio-does-not-exist-in-the-namespace-microsoft>

comments: author: Philip van Veen
body: References do exist. Well it sounds to me that the target machine is missing libraries/part of the SDK. I assume installing VS on that machine would fix it, which I rather don't want to do. I did install MSBuild latest version and I assumed that it will be able to build the solution?! -- It probably can and it did until I added the MS UnitTest project to it. So I guess the question is now: does MSBuild work with MS UnitTest projects? Or how do I add UnitTests to my project in bamboo? I did assume that I just create a UnitTest project, write some tests, commit it and bamboo will automatically "see" those tests?


Tags: bamboo-administration

c

ms-testrunner

visual-studio