I am currently upgrading our build process from .bat files to CruiseControl.Net projects. Mostly C++ projects but a few VB and one C#.
The C# project has a reference to NUnit.Framework.dll, and every thing worked well on the developer machines and the build server when building Visual Studio or using devenv.exe. But I have changed to using MSBuild.exe because that is what the CruiseControl.Net/NAnt example I’ve been following does.
When MSBuild.exe is ran at the command prompt the C# project runs fine, but when run from the CruiseControl.Net service I get the following errors:
errorCS0246: The type or namespace name 'NUnit' could not be found (are you missing a using directive or an assembly reference?)
After lots of hair pulling, I noticed one of the my C# projects had a <HintPath> element inside a <Reference> element. The example was a relative path, but changing it to a full-path was required for my situation, as the projects are loaded to a different location on the build server. So, in my C# project’s .csproj file, I have added this block:
<Reference Include="nunit.framework, Version=2.4.2.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files\NUnit 2.4.2\bin\nunit.framework.dll</HintPath>
</Reference>
I’m not sure how you would set the <HintPath> element from inside Visual Studio.