0

I want to create two files, then have them be associated with each other (similar to if you added an .aspx file which then has child designer and code-behind files).

I know how it works in the project XML: http://mikehadlow.blogspot.com/2006/11/nested-files-with-dependentupon-in.html

...but I can't seem to find a way to do it programmatically. The closest thing I've seen is this: How do I programmatically refresh/reload a VS project after modifying the underlying file?

...which is incomplete and has elements that are unexplained (plus the author said he abandoned the approach altogether).

Does anyone know the proper way to forge such an association programmatically using the Visual Studio SDK?

Community
  • 1
  • 1
Colin
  • 4,025
  • 21
  • 40
  • http://www.codeproject.com/Articles/23243/Addin-to-create-the-Dependent-Upon-Add-in ? – ErikEJ Dec 08 '14 at 20:09
  • @Colin did you find an answer? – Erti-Chris Eelmaa Jan 12 '15 at 14:53
  • I think so but got some higher priority things and haven't confirmed through code. I think the trick is to set a child item on the item you're working with like myItem.ProjectItems.Add() though I forget the exact property name. – Colin Jan 13 '15 at 02:55

1 Answers1

1

For anyone still looking to do this, there is a Visual Studio extension that you can install called File Nesting, written my Microsoft's Mads Kristensen.

There's even the source code for it on GitHub (madskristensen/FileNesting) if you need to add similar functionality in your own extension.

Yann Duran
  • 3,842
  • 1
  • 24
  • 24