Skip to content
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

Buildalyzer could not load files or assemblies #206

Closed
Liam-Rougoor opened this issue Apr 13, 2022 · 5 comments
Closed

Buildalyzer could not load files or assemblies #206

Liam-Rougoor opened this issue Apr 13, 2022 · 5 comments
Labels
Discussion/Question Discussions or questions about the code

Comments

@Liam-Rougoor
Copy link

I'm using Buildalyzer to load projects in a given solution to perform some analysis on the projects' documents. I'm trying to test my implementation on its own solution, but it's showing some weird behaviours:

  • One of the projects in the solution, the project that actually uses buildalyzer, seems to throw an IOException when being built. This exception is thrown in the Buildalyzer.TargetFrameworkComparer class. For some reason, it cannot find the reference to NuGet.Frameworks.
  • When the project above is not built first, the project seems to build properly.
  • I'm experiencing the same issue with some other nuget packages (EPPlus in my case).

When I build the project in Visual Studio 2022, everything works fine. I'm stuck on where this problem is coming from and how to proceed. Is this expected behaviour, or some bug? Is there something I'm missing that I need to fix?

@Liam-Rougoor
Copy link
Author

An update: I copied the solution and the faulty project to a new solution. When I run my implementation on the copy, it all works. So I assume the exception has to do with the project trying to build itself again at runtime. Is this intended, or is there still a workaround to this?

@daveaglick
Copy link
Collaborator

So I assume the exception has to do with the project trying to build itself again at runtime. Is this intended, or is there still a workaround to this?

By default Buildalyzer calls MSBuild (or dotnet build depending on .NET Core vs. Framework, which indirectly calls MSBuild anyway). It tried to do this as closely to a "normal" build as possible - over the years I've discovered that the more Buildalyzer deviates from that, the more problems arise. However, this does create a separate class of problem as you've noticed because it'll shell out to MSBuild, which then tries to build in the normal place. If you're running the application from there at the same time I'd expect some oddness like locked files, etc.

The trick is probably to change the output path, intermediate path, etc. for your particular use case. For more context and some examples see #105 - let me know if that helps at all.

@daveaglick daveaglick added the Discussion/Question Discussions or questions about the code label Apr 18, 2022
@daveaglick
Copy link
Collaborator

Just checking in - have you had any luck with the suggestions above?

@rouke-broersma
Copy link

@Liam-Rougoor ?

@phmonte
Copy link
Owner

phmonte commented Apr 13, 2024

I close this issue, I believe that one of the suggestions resolved it.
Feel free to reopen it with an update.

@phmonte phmonte closed this as completed Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion/Question Discussions or questions about the code
Projects
None yet
Development

No branches or pull requests

4 participants