Giter Site home page Giter Site logo

Build/assembly reference not found errors due to random sorting of the projects in the Workspace when loading projects from solution file about buildalyzer HOT 9 CLOSED

hideintheclouds avatar hideintheclouds commented on June 16, 2024
Build/assembly reference not found errors due to random sorting of the projects in the Workspace when loading projects from solution file

from buildalyzer.

Comments (9)

hideintheclouds avatar hideintheclouds commented on June 16, 2024 1

6.0.3 tag seems to point to the same commit as 6.0.2:
https://github.com/daveaglick/Buildalyzer/releases

I imagine that 6.0.3 should be associated with a new commit corresponding to the change?

from buildalyzer.

hideintheclouds avatar hideintheclouds commented on June 16, 2024 1

Thanks, it seems to be working fine with 6.0.3, I guess that parameter made a difference

from buildalyzer.

daveaglick avatar daveaglick commented on June 16, 2024

Please have a look at the following bug

Was there supposed to be a log file or bug linked here? If so, I don't see it.

Is the problem here that the build itself isn't correctly ordered? We just "shell out" to MSBuild or dotnet build so any project ordering based on the reference graph is the responsibility of MSBuild.

Or am I misunderstanding the problem? Is it that projects are being added into the Roslyn Workspace in an order where some are relying on references from others that haven't been added yet? If this is the case, how could we determine the "correct" order?

Perhaps most importantly is whether there's a reproduceable example of this problem. It'll be hard for me to diagnose and verify a fix without one.

from buildalyzer.

hideintheclouds avatar hideintheclouds commented on June 16, 2024

Hi Dave,
I updated the initial text with the proper url.
I suspect the problem is somehow similar to the second option that you mentioned.

I encountered the issue on a private solution with multiple csproj files, and unfortunately cannot share the source code.

I think that the issue was reported initially using the eShopOnContainers solution as specified in the referenced url.

from buildalyzer.

daveaglick avatar daveaglick commented on June 16, 2024

I think I'm starting to understand the issue after reading the link. I'll implement the fix identified in that thread and see if it helps.

from buildalyzer.

daveaglick avatar daveaglick commented on June 16, 2024

Buildalyzer 6.0.2 is rolling out to NuGet now. Can you test it when you get the chance (you might need to reference the latest version explicitly in your project if you're getting it transitively through LivingDocumentation)?

from buildalyzer.

hideintheclouds avatar hideintheclouds commented on June 16, 2024

Trying the 6.0.2 did not fix the issue. Now the projects always come in the same order in the AdhocWorkspace, but it seems not to find namespaces in the build dependencies (as before).
Note: I was however able to have a working solution using the extension method that @AndreasKim created.

I believe the difference is made by the following:

foreach (AnalyzerResult result in results)
            {
                if (!workspace.CurrentSolution.Projects.Any(p => p.FilePath == result.ProjectFilePath))
                {
                    result.AddToWorkspace(workspace, true);
                }
            }

            return workspace;

When calling the AddToWorkspace with addProjectReferences=true, it seems to add results to the workspace, but also rebuilding and adding the referenced projects.
I even commented out the sorting of the projects, and it still works when calling result.AddToWorkspace(workspace, true);

from buildalyzer.

daveaglick avatar daveaglick commented on June 16, 2024

Of course that's the one little bit I accidentally left out :). I added that flag and 6.0.3 is rolling out now. Hopefully that resolves it once and for all, do you mind checking one more time?

from buildalyzer.

daveaglick avatar daveaglick commented on June 16, 2024

Whops! I got carried away and published the release before committing the code. I publish locally so the 6.0.3 up on NuGet actually does have the change, I just need to update the tag.

from buildalyzer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.