Adding a new file to an project that Depends on another file.

Hi All,

I want to create a new file with a custom extention for my custom VSIP editor then add this file to the project <- no problems so far

Then i want to make this file dependent upon a .cs file, so if its moved the custom file (extension adoc) is also moved (and it looks so much better in the IDE), below is how this looks like in the project file.

<Compile Include="Program.cs" />
<None Include="Program.adoc">
<DependentUpon>Program.cs</DependentUpon>
</None>

Now the question is how can i make a file dependent upon using the either the automation model or the VSIP interfaces? (i have everything available)

Greetings

[683 byte] By [PaulPaschedag] at [2007-12-17]
# 1

Is the lack of replies due to the question not being clear?

Is it imposible?

Doesnt anyone have any clue?

Any help would be much apreciated!!

PaulPaschedag at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio Extensibility...
# 2
Use automation.

_projectItem.ProjectItems.AddFromFile(target);

works for me, where _projectItem is EnvDTE.ProjectItem.

If you have IVsHierarchy, you can obtain it using GetProperty call with __VSHPROPID.VSHPROPID_ExtObject parameter on the appropriate item.

orangy at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio Extensibility...
# 3
Yeah,

I've tried to get the <DependsUpon> to work as well for a custom item but am having a hard time to get them to show up.

I tried using the <Compile> item with my custom project item with a depends statement as well and it doesn't get created under the item.

This is in my custom project and cannot seem to get them to add as a subitem to the dependant item.

I don't have any problem when through code doing an HeiarchyNode.AddChild(mynode)... it I add the item to the project file and everything is fine.. but when the project is reloaded from disk it doesn't populate properly or fire any event to let me create my custom FileNode.

The only thing that I have been thinking of doing is parsing the project myself via an XMLDocument and adding the child nodes through code.. but that just doesn't seem right.

BRCEWANE at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio Extensibility...
# 4
Thanks this worked perfectly!
PaulPaschedag at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio Extensibility...

Visual Studio

Site Classified