81

I had no problem with this in Visual Studio 2008 but it seems that VS 2010 is having an issue, and I'm betting it's probably me.

I have a solution with an ASP.NET Web Site Project and a few C# projects (BLL, DAL, Tests in NUnit). I have configured the build process for the test project to automatically run NUnit to run the tests. I would like to ensure that the BLL and DAL projects build before the test project so that the tests will run against the latest compiled version (yes, I know I could do this all in one project, but I'm choosing not to -- please bear with me :) )

So, I set the dependencies of the Test project to include the BLL, DAL, and Web Application projects, and the build order shows BLL, DAL, Web Application, and then Tests. However, I noticed that the BLL doesn't actually build when I build the Test project.

Any idea what this could be or any option I might be missing to force the other projects to build when I build the Test project?

starball
  • 20,030
  • 7
  • 43
  • 238
SeanKilleen
  • 8,809
  • 17
  • 80
  • 133

4 Answers4

131

Nick Craver mentioned checking the Configuration Manager to ensure you have the project selected to build for a given configuration.

However, to set the build order for multiple projects in a solution right click the solution and choose "Project Build Order..." from the context menu.

M. Travis Volker
  • 2,310
  • 3
  • 20
  • 21
  • 5
    I tried this, but don't see how to affect the order. The note says "Use the Dependencies tab to change the build order", but the other tab only has checkboxes. – AlignedDev Oct 06 '11 at 21:17
  • 19
    You make the project that you want to build first a dependency of the one you want to build last. – Bluebaron Oct 13 '11 at 17:33
  • Then check the other tab to make sure it all worked out for you. – Bluebaron Oct 13 '11 at 17:33
  • The "build" checkbox was correct for me. I had answered and accepted the answer but then it was deleted, I think due to me saying "thanks". Therefore I'll mark this answer as the correct answer. – SeanKilleen Oct 16 '12 at 14:47
  • 1
    See [this answer](https://stackoverflow.com/a/29948807/1143274) for screenshots of all this. – Evgeni Sergeev Feb 05 '19 at 02:16
21

I'll expound upon my comment a bit here, for those having a similar issue.

Open up the configuration manager by right clicking on the solution and choosing Configuration Manager, then make sure build is checked for the appropriate project (for your current configuration) in the right-hand column here:

Configuration Manager

Nick Craver
  • 623,446
  • 136
  • 1,297
  • 1,155
17

Maybe instead of setting order manually you could use Project Dependencies which allows you to specify build order indirectly.

  1. In Solution Explorer, select a project.
  2. On the Project menu, choose Project Dependencies. The Project Dependencies dialog box opens. The Project Dependencies option is only available in a solution with more than one project.
  3. On the Dependencies tab, select a project from the Project drop-down menu.
  4. In the Depends on field, select the check box of any other project that must build before this project does.
sirdank
  • 3,351
  • 3
  • 25
  • 58
Vyktor
  • 20,559
  • 6
  • 64
  • 96
0

To correct the issue happening in my VS2012, I did the following:

Right click Project Properties --> Common Properties --> Framework and References

Now you will find some projects shown on the Dependence Tab are missing in the "References" list.

Click "Add New Reference" to add the missing the projects.

John
  • 11
  • 1