DrG*_*iff 7 c# visual-studio visual-studio-extensions roslyn roslyn-code-analysis
在Visual Studio扩展(VSIX)解决方案中,我使用Roslyn从当前解决方案加载特定项目:
Project myProject =
this.CurrentComponentModel.GetService<VisualStudioWorkspace>()
.CurrentSolution.Projects
.FirstOrDefault(p => p.Name == "MyProject")
Run Code Online (Sandbox Code Playgroud)
proProct myProject肯定是加载的,但在检查时我看到:
myProject.HasDocuments == false
myProject.Documents is Empty
Run Code Online (Sandbox Code Playgroud)
然而,在Visual Studio中,我可以看到大量文档.
如果我关闭解决方案并从另一个TFS分支打开相同的解决方案,则相同的代码返回:
myProject.HasDocuments == true
myProject.Documents is not Empty
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我通过以下方式让它工作:
简单地重新编译没有效果。无法解释为什么,但上面的公式对我有用。
| 归档时间: |
|
| 查看次数: |
786 次 |
| 最近记录: |