views:

116

answers:

4

In VS2005 I have a few C# projects that depend on each other.

If project A depends on B (e.g. references it), then I want B to build whenever I build A, assuming B has changed in some way since last built. That's the way it is with VC projects, but for some reason it doesn't seem to work with C# projects. If I clean B and then build A it just tells me that it can't find B...

Any ideas?

+1  A: 

You need to build the actual solution not the projects individually.

James
Not an option, since the solution contains many other projects as well, some of which I don't wish to build at this moment.
Assaf Lavie
+2  A: 

If you right-click on your Visual Studio Solution and choose "Project Build Order" you can verify the order in which those individual projects are being built. ALSO make sure that you aren't referencing a "debug" DLL in a "release" build and vice versa.

Matt
The build order is fine. As I said: A references B and it shows as such in the dependency window and in the build order.How can I reference a debug build in a release build? The reference is between projects...
Assaf Lavie
A: 

If you add all the projects to the same solution and set up the dependencies between them then Visual Studio should be able to work out the correct order and build everything that needs building when you change something in one of the "lower" projects.

In your case it would know that it had to rebuild B before building A.

ChrisF
A: 

override the target AfterResolveReferences in your csproj. Then use the item @(NonVCProjectReference) to list the path to every project and build them. I recommend you to read the MSBuild documentation

Nicolas Dorier