0

I have a small program that retrieves the resource strings from the .resx files of the Projects in a Solution. The Project is accessed using Microsoft.Build.Execution.ProjectInstance() and we then iterate over the Microsoft.Build.Execution.ProjectItemInstance items in the Items collection.

It would be helpful in this program to extract the relationship between some of the .resx files and related items, for example, Form1.cs, Form1.resx, and Form1.fr-CA.resx. I can see in the .csproj file they are related using the DependentUpon property. Unfortunately that property doesn't appear to be exposed in Microsoft.Build.Execution.ProjectItemInstance.

How can I retrieve the DependentUpon property of an EmbeddedResource Item of a Project? The environment for this program is VS2015; the Solutions and Projects it is navigating are VS2008 Compact Framework 3.5.

1 Answer 1

1

You should be able to use the GetMetadataValue() function to retrieve the metadata value.

var dependentUponValue = itemInstance.GetMetadataValue("DependentUpon");

Note that this may return an empty string if the requested metadata is not defined on the item.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.