Reputation: 1243
My solution structure is like this:
It is configured like that in the build dependencies. The displayed build order (right click on the solution -> project build order) is the correct one (Project B -> Project A -> Installer). But for some reason when i try to rebuild the whole solution thats not the order in which Visual Studio actually tries to build the projects. It always starts with Project A which of course then fails cause of the missing dependency of Project B.
If i manually build the projects in the right order everything works.
In my .sln file projects are listed like this:
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectA", ProjectA\ProjectA.csproj", "{B80B7A8F-0576-41FA-BD3D-B3C6F5F8D6E7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectB", "ProjectB\ProjectB.csproj", "{D127D2C1-0F13-41F1-B4A1-218BC53ABC40}"
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Installer", "Installer\Installer.wixproj", "{1D504782-E92A-4C60-9ADC-6067E7E301AA}"
ProjectSection(ProjectDependencies) = postProject
{B80B7A8F-0576-41FA-BD3D-B3C6F5F8D6E7} = {B80B7A8F-0576-41FA-BD3D-B3C6F5F8D6E7}
{D127D2C1-0F13-41F1-B4A1-218BC53ABC40} = {D127D2C1-0F13-41F1-B4A1-218BC53ABC40}
EndProjectSection
EndProject
Any idea what might cause this issue?
Upvotes: 1
Views: 3931
Reputation: 3933
I had the same problem. I was able to build my solution in Visual Studio. But when building it on Azure DevOps Pipelines with MSBuild, it built them in the wrong order; with my WiX .wixproj
project being built before one of its dependencies.
My .sln
file looked like this:
What I did to solve the problem, was to manually add more dependencies to this file:
So my advice is to look in your .sln
file and add additional dependencies that you think would make sense.
Upvotes: 0
Reputation: 23808
Usually, the build order is saved in the solution file(.sln
file) like this:
So when you use this, you should build the whole solution with that file. But
However, in vs IDE, when you build A single project, it can follow the specified build order, but in msbuild command line, msbuild projectA.xxproj
does not build B first and then build A according to the specified dependencies. This is also unique to vs ides, although the build dependencies are stored in xxx.sln
rather than individual xxx.proj
files.
Unless the entire solution(msbuild xxx.sln
) is built in MSBuild Command Line, it will be built sequentially.
This is the situation that generally causes this difference.
But for some reason when i try to rebuild the whole solution thats not the order in which Visual Studio actually tries to build the projects.
I wonder what you did caused this and if you build the whole solution(xxx.sln
file), this issue will not happen. So I want to know which build format or what you did to your solution.
Since MSBuild cannot build wixproj
file, so you should use VS IDE or devenv xxx.sln /build to build the whole solution.
Suggestion
As a suggestion, you could use Project Reference instead to specify build order which will set the order in every xxx.proj
rather than xxx.sln
file. This will be more reliable and safe.
1) Remove the build orders under Project Dependencies(Right-click on Solution)
2) Right-click on WIX project-->References
-->Add Reference
-->Projects
-->Select Project A
and Project B
.
3) Right-click on Project A-->References
-->Add Reference
-->Project
-->Project B
.
In addition, if it does not help you, please share with us what you did to cause this issue and any steps which caused it so that it will help us troubleshoot your issue more quickly.
Update 1
Just hint from Eric, and thanks to him for sharing the solution and test result.
Solution
First, remove all the project dependencies and then re-add them, after that, it fixes the issue. It could be an issue to this project since it was migrated from old VS2010.
Upvotes: 2