Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.dll reference loads properly into c# project in Debug mode but can't find namespaces in Release

I'm setting up a CI server for my company and integrating Unit Testing. I've chosen to use TeamCity and NUnit, as they've worked well for other organizations I've worked for in the past.

I have TeamCity up and running and I've created just a test Unit Test project for now so I can verify that TeamCity is handling my NUnit configuration properly. In my project, I've added a reference to nunit.framework.dll which lives in a folder at the root of my solution. When I committed up the solution to test, this was the output I got from my build step in TeamCity:

[10:45:35][Csc] UnitTesting.cs(5, 7): error CS0246: The type or namespace name 'NUnit' could not be found (are you missing a using directive or an assembly reference?)

[10:45:35][Csc] UnitTesting.cs(16, 10): error CS0246: The type or namespace name 'Test' could not be found (are you missing a using directive or an assembly reference?)

[10:45:35][Csc] UnitTesting.cs(16, 10): error CS0246: The type or namespace name 'TestAttribute' could not be found (are you missing a using directive or an assembly reference?)

[10:45:35][Csc] UnitTesting.cs(13, 6): error CS0246: The type or namespace name 'TestFixture' could not be found (are you missing a using directive or an assembly reference?)

[10:45:35][Csc] UnitTesting.cs(13, 6): error CS0246: The type or namespace name 'TestFixtureAttribute' could not be found (are you missing a using directive or an assembly reference?)

When I went back to my IDE, I was able to build the solution without seeing those error messages. Until I switched to Release config. As soon as I switched the config and built the solution, I got the same messages in my IDE that I got from TeamCity.

I tried adding the .dll file to my project again, but Visual Studio complained that the reference is already there and prevented me from adding it again.

What gives?

like image 240
Brandon Avatar asked Jan 15 '14 16:01

Brandon


1 Answers

Pretty much what happened here is: Visual Studio forgot what was going on and lost touch with reality for no reason and didn't know where to look for the .dll. I don't know why it only happened in Release config, but I deleted the reference and re-added it and all is well and good.

like image 153
Brandon Avatar answered Sep 20 '22 01:09

Brandon