Visual Studio 2013 Solution building not in build order

29,517

Solution 1

Solution is very simple.

You can set your project build order by right click on 'Project Solution' and select "Select Project Build Order" option.

enter image description here

For Example, I have a WpfFormApplicaiton1 and two class with title "ClassLibrary1" and "ClassLibrary2". By default Visual Studio sets it as follow:

enter image description here

My requirement is such as "ClassLibrary2" will be used by "ClassLibrary1" & "ClassLibrary1" will be used by "WpfFormApplication1". So, in order to fulfill this requirement I have to change the default project build order.

Go to Project Dependencies; Select the "ClassLibrary1" and set the "ClassLibrary2" as its dependency.

enter image description here

Similary, select the "WpfFormApplication1" and set the "ClassLibrary1" as its dependency.

enter image description here

Now, the desired project build order is set; confirmed by Project Build Order's options.

enter image description here

Solution is taken from my blog.

Solution 2

Your issue may be that the Dependencies are not defined. Even though the Build Order shows the order in which projects are built, if you do not define the dependencies for each one under Project Dependencies, msbuild will not know to wait for the dependencies build to complete before moving on.

To clarify: Unless you actually check the box that an item is a dependency, the projects in the build order list may build in parallel and not sequentially.

You can see under Tools->Options->Project and Solutions->Build and Runthat there is a default value for the number of parallel projects to build. enter image description here

So to make the build process wait for dependencies to build make sure that all of the "Depends on" fields are checked for the projects needed under Project Dependencies -> Dependencies.

Solution 3

We had an issue where the project guids differed in case. Editing the project files solved the issue. We changed all Guids to uppercase

Solution 4

I just had this issue too. In my case the issue was that I had several project references within the solution. The other projects were using a different version of the framework to my Worker Role (4.5.1 vs 4.5).

When I changed all projects to use the same version of the framework the solution builds and runs successfully.

Solution 5

I had this issue. In my case, the solution's project build order, as determined by VS.Net, was not correct. Specifically, my web project was listed above three of its dependencies.

These three dependencies were listed under in the References node of the web project in the Solution Explorer. However, in the dialogue Project Dependencies, the web project did not depend on any project.

Also, I noticed that the web project had a small blue exclamation mark, with hoover-over message "The Web project '' requires SQL Server Express, which is not installed on this computer. ...". After fiddling with the web.config, based on ASP.NET Web Api: Project requires SQL Server Express and reloading the project, the exclamation disappeared and the project dependencies were correctly checked in the dialogue Project Dependencies and the build order reflected this correctly. However, when I reverted the changes to the web.config, as a test, the dependencies were not removed, so I am quite unsure what fixed my issues.

Anyway, in the dialogue Project Dependencies, you can manually check any project which was not automatically identified as a dependency.

Share:
29,517
lockwobr
Author by

lockwobr

Updated on December 02, 2020

Comments

  • lockwobr
    lockwobr over 3 years

    I am having problems getting my C# Solution to build "Fresh". If I clean the solution and build it again it will not build (I can do it a few times and it will build). It has an error about the azure project getting build before the worker and web projects that it is dependent on. Also about how most of the projects in the solution are looking for

    WAT070 : The referenced assembly {...}/Worker.dll was not found. 
    Please make sure to build the role project that produces this assembly before building this Windows Azure Cloud Service Project.
    {...}\VisualStudio\v12.0\Windows Azure Tools\2.2\Microsoft.WindowsAzure.targets 1252    5   AzureProjectName
    

    Now if I build the projects in the order listed in the Project Dependencies -> Build Order everything works. Also, the web and work role are listed before Azure Project.