How can I resolve all references with Roslyn's OpenSolutionAsync?

前端 未结 2 760
不知归路
不知归路 2021-01-06 00:36

I\'m trying to open RoslynLight.sln with OpenSolutionAsync then iterate through all the projects. For my purposes I need a semantic model and resolved references. Through

相关标签:
2条回答
  • 2021-01-06 01:03

    I'm looking at fixing this in the MSBuild targets, but in the meantime, the following workaround should address the issue. Instead of using:

    MSBuildWorkspace.Create();
    

    use:

    MSBuildWorkspace.Create(new Dictionary<string, string> { { "CheckForSystemRuntimeDependency", "true" } });
    
    0 讨论(0)
  • You only need to add the façade references if the project is targeting the "full" .NET framework. So if you look at the existing references first, if there are any references that come from Reference Assemblies\Microsoft.NETPortable\v4.5\Profile\... then you shouldn't need to add them.

    0 讨论(0)
提交回复
热议问题