views:

28

answers:

2

I am using Visual Studio and a solution with 10 or so projects in (mostly VB, some C#) which have various dependencies set up. Usually when I compile the solution it works fine. Occasionally when I do it I get a build error saying that one of the projects referenced is the wrong version (I think always the same one, possibly may be two that can cause problems). In this case going to the solution explorer and right clicking on the mentioned project and saying "rebuild" followed by another full build makes it work fine.

I assume there is something set up wrong somewhere but I didn't set up the solution myself initially and a quick look through doesn't show anything immediately wrong.

It feels like there is some kind of race condition, that VS is internally setting the version number of the project it needs before that project has been rebuilt and thus gets it wrong or something like that but I'm sure VS should handle all this sort of thing properly.

Can anybody please suggest places that I could check for whether this has been correctly set up...

And I should finally note that since I don't have reliable repro of this I may not be able to respond to questions too quickly. For example the obvious one of "Could you give the exact error message" will have to wait since I didn't think to copy it this morning, it was only after I cleared it up with the above steps that I thought to post here. Similarly any solutions may take a while to confirm.

Edit to add error message:

Indirect reference is being made to assembly ODP version 1.0.3792.16586, which contains '{{CLASSNAME}}'. This Project references a prior version of ODP version 1.0.3791.18659. To use '{{CLASSNAME}}', you must replace the reference to ODP with version 1.0.3792.16586 or higher.

Edit for more apparently relevant details

Since it has been bought up I will clarify that one of the projects is a web project and that it is this one which is generating the above error message.

Further edit

Having looked further there is a copy of ODP.dll in the bin diretory of my web project. Using windows explorer and right clicking, asking for properties and looking at the version it is version 1.0.3791.18659. Having deleted this (actually moved it elsewhere) when doing a build it recreated this file still with that same version number (ie an old version number).

ODP claims to be a project reference too which still makes me think it should just work... :(

A: 

Is the build order correct? I can imagine if you build one project which references the other one, and that one isn't built yet you can have this kind of problem.

Link: http://msdn.microsoft.com/en-us/library/5tdasz7h%28v=VS.80%29.aspx

Snake
My understanding is that the fact there are dependancies set up means it should build them in the right order. The error seems to be getting thrown in the web project which is last on the build order list anyway... Having checked the build order the problem assembly is third in the build order list. I'll bear it in mind though.
Chris
A: 

If you have a website project, are you sure you have set these to be 'project' references rather than 'bin' references - you could be getting some issues this way.

Paddy
I do indeed have a website project and it is in here that it is throwing the error in question. And this does sound like it makes a lot of sense as an explanation (assuming that project references refer to the projects themselves and bin references to the dlls in the bin directory.
Chris
I've checked that and it is definitely a project reference. Additionally as I've now edited into the original question if I delete the files from the bin directory it recreates them with that old version number still...
Chris