views:

254

answers:

2

We're upgrading from Dev Studio 2005 to Dev Studio 2010. I opened my 2005 solution in Visual Studio 2010 and went through the conversion process keeping all projects targeted at .NET 2.0. When I try to build the project, my references to Rhino.Mocks.dll are failing to be used. I see errors like this:

DalDiscoveryTest.cs(7,7): error CS0246: The type or namespace name 'Rhino' could not be found (are you missing a using directive or an assembly reference?)

I went into my project and removed the reference to Rhino.Mocks.dll and attempted to re-add it. Then I get a dialog that reads:

'Rhino.Mocks.dll', or one of its dependencies, requires a later version of the .NET Framework than the one specified in the project. You can change the .NET Framework target by clicking Properties on the Project menu and then selecting a new target in the '.NET Framework' dropdown box. ...

I'm using "Rhino Mocks 3.5 for .NET 2.0" available at http://www.ayende.com/projects/rhino-mocks/downloads.aspx. This project builds fine in Dev Studio 2005 using .NET 2.0. The only was around the issue that I've found is to change the target of the test projects to .NET 3.5, but I'm wanting to minimize changes initially.

Is there any way around this problem besides changing the target to a newer version of .NET?

+2  A: 

I contacted MSDN support directly to try to get a hotfix for this issue. They were able to reproduce this problem in Visual Studio 2008 and 2010. There isn't a hotfix, but there is a relatively simple fix you can do by modifying your project's settings.

  1. Add the reference to the third-party DLL (Rhino.Mocks.dll) into the project and ignore the warning by clicking "Yes".
  2. Click on the project reference and in the property window modify the "Specific Version" of Rhino.Mocks to "True".
  3. Right click on the project node in the solution explorer in Visual Studio 2010 and select "Unload Project".
  4. Right click on the project node and select "Edit Your Project Name Here".
  5. After the line starting with <Reference Include="Rhino.Mocks, ...">, add the following line: <SpecificVersion>True</SpecificVersion>.
  6. Reload the project by right clicking the project node and select "Reload".
  7. Rebuild your project.

This worked for me.

Eli
I had a very similar issue and this solved it for me. Thanks a lot.
No Average Geek
A: 

I just ran into this issue as well. After a bit of searching I found this post from Chris May (Thanks Chris!)

http://chrismay.org/CommentView,guid,09c435a9-897a-4800-a6cf-ad0e2cd2467c.aspx

I guess there's a conflict between the static method and the extension method both named "Expect".

As per the post, I fully qualified the expects method and it fixed problem #1. Then changing the <SpecificVersion /> issue, fixed the other build issues I was having.

Marc