Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

How do I programmatically add items to a Project and create the dependency relationship (DependUpon)?

$
0
0

Hi, 

I am programmatically adding a few files to a Project in my extension, but how can I specify dependency of a few of them to a file (like doing the following

    <Compile Include="About.aspx.cs">
      <DependentUpon>About.aspx</DependentUpon>
      <SubType>ASPXCodeBehind</SubType>
    </Compile>

I have tried to do something like this

            var events = (EnvDTE.ProjectItemsEvents)_dte.Events.GetObject("CSharpProjectItemsEvents");

  events.ItemAdded += new _dispProjectItemsEvents_ItemAddedEventHandler(events_ItemAdded);

But it doesn't work. 

I also tried to implement IVsHierarchyEvents my Package and register a FactoryEditor class (implementing IVsEditorFactoryNotify), none of them works.

I am now really clueless. 

It seems there is a way to do it by writing an Addin, but I don't want an Addin, I need to do it in the package. Can anyone help please?

thanks 


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>