Search code examples
c#asp.netxmlasp.net-corevsix

VSIX Package and .NET5 project


I'm creating a VSIX project to read all the Config.xml files in the solution to generate many files within each project.

I'm having difficulty finding the Config.xml file inside a project and I believe it is because of the new Asp Net 5 project structure.

dte.Solution.Projects.Item(1) returns the "src" folder.

dte.Solution.Projects.Item(1).ProjectItems.Item(1).Name will return the project folder.

Then I cannot go any deeper inside the project because the item returned for the project is a ProjectItem and not a Project. ProjectItems do not have items.

How can I get a specific file in my project under asp net 5? I am currently using a "Tools > Command" to execute the code. Would an project and/or xml file right click context menu fix this? If so how would I implement that?


Solution

  • Use the ProjectItem.SubProject property. See an example here:

    HOWTO: Navigate the files of a solution from a Visual Studio .NET macro or add-in