简体   繁体   中英

How do I find the AdditionalIncludeDirectories in a Microsoft.Build.Evaluation.Project object?

I need to programmatically update the AdditionalIncludeDirectories deserialized from a VS 2010 .vcxproj file. Where are these definitions stored within the Microsoft.Build.Evaluation.Project object? I have examples but cannot seem to get a canonical answer.

That is meta data that is a child of a ProjectItem instance.

ProjectItem:

https://docs.microsoft.com/en-us/dotnet/api/microsoft.build.evaluation.projectitem?view=netframework-4.7.2

and Metadata is a property off of that:

https://docs.microsoft.com/en-us/dotnet/api/microsoft.build.evaluation.projectitem.metadata?view=netframework-4.7.2#Microsoft_Build_Evaluation_ProjectItem_Metadata

But why are you modifying that at runtime? Sounds like you are doing something wrong.

The answer turns out to be under the ItemDefinitionGroups under the Xml field of the object. The information is found nowhere else. The data is editable, at least to the extent I needed it to be, so that changes are reflected when one serializes the object to disk. There is very little documentation of this feature anywhere.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM