Assaf Lavie
Assaf Lavie

Reputation: 76093

Build C# Projects and their dependencies

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?

Upvotes: 0

Views: 2138

Answers (5)

Nicolas Dorier
Nicolas Dorier

Reputation: 7475

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

Upvotes: 0

Henk Holterman
Henk Holterman

Reputation: 273681

A Solution lets you define Dependencies between Projects. And if you use that, it should work automatically. Normally the dependencies are set up automatic too. Chances are you added a reference to the assembly, not the project. Watch the Projects tab in the Add reference dialog.

Upvotes: 1

ChrisF
ChrisF

Reputation: 137188

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.

Upvotes: 0

Matt
Matt

Reputation: 174

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.

Upvotes: 2

James
James

Reputation: 82136

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

Upvotes: 1

Related Questions