Friday 29 August 2008

NUnit missing assembly reference error

Recently I have been getting a few errors running Nunit on our automatic build server. Nunit is being called through an MSBuild file, which is being called by CruiseControl.NET. The CruiseControl build log has been recording the error messages below:
EventLogListenerTest.cs (6,7): errorCS0246: The type or namespace name 'NUnit' could not be found (are you missing a using directive or an assembly reference?)
EventLogListenerTest.cs (18,10): errorCS0246: The type or namespace name 'TestFixtureSetUp' could not be found (are you missing a using directive or an assembly reference?)
EventLogListenerTest.cs (18,10): errorCS0246: The type or namespace name 'TestFixtureSetUpAttribute' could not be found (are you missing a using directive or an assembly reference?)
EventLogListenerTest.cs (25,10): errorCS0246: The type or namespace name 'TestFixtureTearDown' could not be found (are you missing a using directive or an assembly reference?)
EventLogListenerTest.cs (25,10): errorCS0246: The type or namespace name 'TestFixtureTearDownAttribute' could not be found (are you missing a using directive or an assembly reference?)
These errors are only happened when I ran CruiseControl as a service... so I logically assumed that this must be a security issue with the Local service account not being able to see the Nunit assemblies. However, the issue was not resolved by running the service as the logged in user.

The solution I found was to manually add the Nunit.Framework.dll from the Nunit directory in "c:\program files" to the Global Assembly Cache (GAC). This resolved all the missing assembly reference" errors.

No comments: