As written in this question:
Can I access MsBuildWorkspace from the MsBuild task class?
You cannot use MSBuildWorkspacefrom an MSBuild task for the same project. However, only 2 other options: VisualStudioWorkspaceand AdhocWorkspace.
MSBuildWorkspace
VisualStudioWorkspace
AdhocWorkspace
Does this mean that there is no option to load the project from the MSBuild task?
I found a solution in this post: Roslyn: loading the workspace in a console application, but not in the msbuild task
It still feels like a workaround, however it works. In fact, it’s beneficial for this that the project does not need to be compiled anymore to download the project!
CommandLineProject.CreateProjectInfo, , csc, .
CommandLineProject.CreateProjectInfo