为什么 VS 2017 项目中的 Dynamics 365 上的 EnvDTE.ProjectItem.FileCodeModel 为 Null
我正在编写代码以从 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 ProjectItem.FileCodeModel 的文档,“仅对于代码文件形式的项目项以及实现 Visual Studio 代码模型的项目返回 FileCodeModel 对象。”
由于 x++ 是一个非常远房表亲对于 .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 x++ 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.