为什么 VS 2017 项目中的 Dynamics 365 上的 EnvDTE.ProjectItem.FileCodeModel 为 Null

发布于 2025-01-13 05:16:07 字数 757 浏览 7 评论 0原文

我正在编写代码以从 D365 项目中的 .xpp 文件获取 CodeElements,但 FileCodeModel 值始终为 null

foreach (Project project in applicationObject.Solution.Projects)
 {
                        var projectItems = GetProjectItemsRecursively(project.ProjectItems);
                        foreach (ProjectItem item in projectItems)
                        {
                            if ((item.FileCodeModel != null))
                            {
                                
                                foreach (CodeElement elem in item.FileCodeModel.CodeElements)
                                {
                                    
                                }
                            }

                        }
                    }

I am writing code to get the CodeElements from .xpp file in D365 project, but FileCodeModel value is always null

foreach (Project project in applicationObject.Solution.Projects)
 {
                        var projectItems = GetProjectItemsRecursively(project.ProjectItems);
                        foreach (ProjectItem item in projectItems)
                        {
                            if ((item.FileCodeModel != null))
                            {
                                
                                foreach (CodeElement elem in item.FileCodeModel.CodeElements)
                                {
                                    
                                }
                            }

                        }
                    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

万劫不复 2025-01-20 05:16:07

根据 ProjectItem.FileCodeModel 的文档,“仅对于代码文件形式的项目项以及实现 Visual Studio 代码模型的项目返回 FileCodeModel 对象。”

由于 是一个非常远房表亲对于 .NET 系列,我的猜测是它的文件(组合代码和元数据的 .xml 文件)不会被识别为代码文件和/或 D365FO 项目没有实现 VS 代码模型。

According to the documentation for ProjectItem.FileCodeModel, "A FileCodeModel object is returned only for project items that are code files and in projects that implement the Visual Studio code model."

Since is a very distant cousin of the .NET family, my guess would be that its files (.xml files that combine code and metadata) are not recognized as code files and/or the D365FO projects do not implement the VS code model.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文