-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Order of projects in solution file affects build results #6198
Comments
Team Triage: Verify the repro works & gather some info, then add the untriaged label. |
So I got it to repro and captured binlogs of each build: solutions.zip Unfortunately I couldn't repro after that. The tests seemed to work for me with the updated solution. Are you still seeing this with an updated msbuild? It actually looks like you may have fixed the issue with https://github.com/Rubjerg/Graphviz.NetWrapper/pull/35/files? The general idea here is you want to use ProjectReference to ensure certain projects are built first. When msbuild encounters a |
I just re-ran the workflow in the reproduction PR for you, and still the same error occurs: https://github.com/Rubjerg/Graphviz.NetWrapper/pull/33/checks?check_run_id=2465253939 You should be able to reproduce by checking out that PR which is also referred to in the OP. https://github.com/Rubjerg/Graphviz.NetWrapper/pull/35/files doesn't seem relevant, because the reproduction PR actually branches off from that commit. |
Using our latest preview |
On github the build action reports:
|
@chtenb I tried to reproduce this issue on 16.8.6 with MSBuild 16.8.3+39993bd9d, and I couldn't reproduce this issue. Could you please help to check the repro steps in case I missed something? And to reproduce this issue, we tried to delete 'Rubjerg.Graphviz.Test.dll' manually from directories after step 3, then execute step 4, and we still couldn't get this issue reproduce, does it make sense?
|
@v-codyguan It looks like you forgot to pass the test.dll to the testrunner. The full test command of step 4 should be:
Otherwise your steps look fine. I just repro'd with version |
Hi @chtenb thank you for sharing! We can reproduce this issue and contact our engineer in time. Thanks! |
Hi @benvillalobos We verified this issue on 16.8.6 with MSBuild 16.8.3+39993bd9d and 16.11.4 with 16.11.1+3e40a09f8, this issue reproduced after passing the test.dll to the testrunner in step 4. Could you help to take a look? If you need repro machine, please feel free to contact us! |
This one's a doozy. I don't fully understand the issue here, but I'm fairly certain it has to do with incremental builds. Marking as note to self: Relevant path where the DLL's need to exist: Side note: Passing |
Interesting, I didn't know about that parameter. Any reason why that isn't on by default? And can Visual Studio pass it as well? |
I don't know the details, just that there are many reasons unfortunately You should be able to set up Command Line Arguments in the properties of your project. You could specify |
Dropping some context on this before it all disappears: Judging by the following symptoms:
It's gotta be a build ordering issue, or that a certain project isn't copying the bits to the right place where another project may have been doing that (this is controlled by ReferenceOutputAssembly (see #7986 for notes on that). So this could be a transitive reference issue, which I'm not too sure of a good solution for. I think the simplest solution here is for your test project to reference your vcxproj and set Airing out another workaround, you can create a target in your test project that looks for your cpp dll and copies it to where it needs to be in order for this test to run. Sorry this one took a while to get back to 😅 |
Thanks for coming back to this! Unfortunately the two workarounds you proposed are not more convenient for me than using a project order in the solution that works. Having all dependent projects reference this C++ project or add a custom target is unfeasible for large solutions and generally undesirable for a project that is meant to be pretty much plug-and-play.
Based on my anecdotal experience with build problems I'd definitely think so. Transitive copying behavior (or the lack thereof) has always caused headaches in my projects, especially when C++ projects were involved. I hoped that I had provided a tangible problem in this area with this github issue + example project, for which the solution or workaround hopefully could be made an example of for how to solve this nagging problem once and for all :) |
See if #9709 is related |
Tested this issue with MSBuild main branch merged #10836. Still has the error occasionally ----> "System.DllNotFoundException : Unable to load DLL 'gvc.dll': The specified module could not be found" when change the project order in solution Rubjerg.Graphviz.sln |
Visual Studio Version: 16.8.6
Summary:
The order in which projects are listed in the solution (.sln) file affects the results of the building process. In my case, for some orders the build results are correct, and for others they are not. It seems to me that this is a bug and the order of the projects should not matter at all, since the correct references are set and the derived build order seems valid in both cases.
Moreover, this problem only occurs when executing
MSBuild Rubjerg.Graphviz.sln
from the commandline (Developer Command Prompt for VS 2019). From within Visual Studio the build always succeeds. MSBuild version is the newest:16.8.3.61104
.Context:
I encountered this problem in a very small opensource project, so it's easy for other people to reproduce. The solution (
Rubjerg.Graphviz.sln
) consists of a single .NET library (Rubjerg.Graphviz.csproj
) with a dependency on a single C++ library (GraphvizWrapper.vcxproj
). The remaining projects are test projects.Steps to Reproduce:
Check out the master branch of https://github.com/Rubjerg/Graphviz.NetWrapper
Restore the solution nuget packages:
nuget restore Rubjerg.Graphviz.sln
.Build the solution on a command prompt:
MSBuild Rubjerg.Graphviz.sln
.Run the unittests on a command prompt:
packages\nunit.consolerunner\3.12.0\tools\nunit3-console.exe Rubjerg.Graphviz.Test\bin\x64\Debug\net48\Rubjerg.Graphviz.Test.dll
Notice that the build succeeds and the tests pass. This is also indicated by the github workflow run on the latest commit of the master branch.
Clear all build artifacts (e.g. by running
git clean -dfx
in the root of the repository)Change the solution file according to the diff shown in this reproduction scenario
Repeat step 2, 3 and 4
Expected Behavior:
Succeeding build and succeeding unit tests.
Actual Behavior:
Notice that after step 2 the C++ DLLs are not present in the output directories of the managed projects. If you execute step 3, you will notice the
System.DllNotFoundException
s. This is also indicated by the github workflow run on the reproduction scenario.User Impact:
All clients of our project run into this problem and have to meddle with the project order in the solution file to fix it.
The text was updated successfully, but these errors were encountered: