问题描述
正如这个问题所写:
我可以从内部访问 MsBuildWorkspaceMsBuild Task 类?
不能将 MSBuildWorkspace
从 MSBuild 任务中用于同一项目.但是,仅有的 2 个其他选项是 VisualStudioWorkspace
和 AdhocWorkspace
.
You cannot use MSBuildWorkspace
from an MSBuild task for the same project. However, the only 2 other options are VisualStudioWorkspace
and AdhocWorkspace
.
这是否意味着无法从 MSBuild 任务加载项目?
Does this mean that there's no option for loading a project from an MSBuild task?
推荐答案
我刚刚在这篇文章中找到了解决方案:Roslyn:控制台中的工作区加载应用程序,但不在 msbuild 任务中
I just found the solution in this post:Roslyn: workspace loads in console application but not in msbuild task
这仍然是一种解决方法,但它确实有效.它实际上有一个好处,即无需再编译项目即可加载项目!
It still feels as a workaround, however it's working. There's actually a benefit to it in that the project doesn't have to be compiled anymore in order to load the project!
这篇关于Roslyn:如何在 Visual Studio 之外加载现有项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!