Closed biqas closed 4 years ago
I'm not sure about your situation, but I had that exception once. In my case it was because I was building the very same project that I executed, so MSBuild cleaned out important files under my feet.
Hmm, but I thoutgt that is one of the main goal to be able to have a workspace for the current/same project or not? Does this means this is not porssible?
@biqas Just to be clear: the scenario I described above is when MyCoolProject
tries to build itself while it's already running. In other words, MyCoolProject
tries to build MyCoolProject
. It basically eats its own tail by cleaning out stuff while running. If this is your scenario, you should build and copy the files required for execution into a separate location before running.
If the above is not your scenario then my solution doesn't apply.
If this is your scenario, you should build and copy the files required for execution into a separate location before running.
Thanks for the assist @jonas-johansson! That's exactly right - Buildalyzer doesn't work well when being used from the same project being run. To be more specific, it doesn't work well when you're running the project from the same location MSBuild would try to build it to.
Does this means this is not porssible?
It's still possible, you just have to run the application from somewhere other than where MSBuild would build it. The way Buildalyzer works is by essentially running dotnet build
in the background. It has the same limitations as if you tried to run dotnet run
and then in a second command window dotnet build
while the first was still running.
One way to get around this is to publish the application (dotnet publish
) that runs Buildalyzer and run it from the published location, pointing it to it's own project file. Since the published executables are self-contained and different from the ones MSBuild would normally produce, they won't conflict.
If the above is not your scenario then my solution doesn't apply.
@biqas Does this explanation sound like it's what you were hitting? Were you running Buildalyzer against the currently executing application?
@daveaglick the explanation was exactly I was hitting, will test how feasible it is to copy around the needed files. Yes I was using the same project for analyzer.Build().
Hi,
just tried out the sample in readme with Roslyn workspace an getting an error:
Error:
System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Composition.TypedParts, Version=1.0.31.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.'