VSTemplate&MSBuild Category

Leave a comment

Unload VSPackage Project, then add MSBuild XML setting: http://msdn.microsoft.com/en-us/library/5dy88c2e.aspx

<!– To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name=”BeforeBuild”>
</Target>
–>
<Target Name=”AfterBuild”>
<ItemGroup>
<!– Mashup and WebService of Authoring Category, Orlando, 2011-08-18 –>
<AuthoringZipItemFilesToCopy Include=”.\$(BaseIntermediateOutputPath)$(Configuration)\HtmlMashupAuthoring.zip” />
</ItemGroup>
<Message Text=”Copying Zip Files to runtime folder”>
</Message>
<!– Mashup and WebService of Authoring, Orlando, 2011-08-18 –>
<Copy SourceFiles=”@(AuthoringZipItemFilesToCopy)” DestinationFolder=”..\$(Configuration)\Templates\ItemTemplates\MashupWebService Authoring” SkipUnchangedFiles=”true”>
</Copy>
</Target>
<Import Project=”$(MSBuildExtensionsPath)\Microsoft\VisualStudio\DSLTools\v10.0\Microsoft.DSLTools.targets” />
</Project>

Refer to :

About IVsHierarchy Structure for VSPackage Development

Leave a comment

VSPackage Hirerachy Series 0
VSPackage Hirerachy Series 1
VSPackage Hirerachy Series 2

Parameter checking-up for ItemId

Structural Properties

In the second part of the mini-series I illustrated how structural properties form the hierarchy of nodes in the collection of items behind an IVsHierarchy instance. The IDs of structural properties are defined in the __VSHPROPID enumeration. I summarize them in the table below. When I use the term “node” in the table I always mean the node within the collection of hierarchy items having the ID passed in the itemid parameter of the getter or setter.

ID Description
VSHPROPID_Parent The VSITEMID of the node’s parent item. For example, in projects a folder node is the parent of the files put into that folder. The property uses a System.Int32 value. If the node is a direct parent of the root node, VSITEMID_ROOT is retrieved. If the node is at the root level and it does not have a parent, VSITEMID_NIL is returned.
VSHPROPID_FirstChild The VSITEMID of the first child parented by the node in the physical layout of the hierarchy. The property uses a System.Int32 value. If the node is a leaf node and so does not have children VSITEMID_NIL is returned.
VSHPROPID_NextSibling The VSITEMID of the next sibling node in the physical layout of the hierarchy. The property uses a System.IntPtr value. If the node is the last one on its parent’s siblings list, a VSITEMID_NIL value is returned.
VSHPROPID_FirstVisibleChild The VSITEMID of the first visible child parented by the node in the visual layout of the hierarchy. The property uses a System.Int32 value. If the node is a leaf node and so does not have children VSITEMID_NIL is returned.
VSHPROPID_NextVisibleSibling The VSITEMID of the next visible sibling node in the visual layout of the hierarchy. The property uses a System.IntPtr value. If the node is the last one on its parent’s siblings list, a VSITEMID_NIL value is returned.
VSHPROPID_ParentHierarchy The IVsHierarchy instance owning the hierarchy of the node. If the hierarchy is not owned (nested) by any other hierarchy this property retrieves null. You can use this property for any node in the hierarchy; they will return the same parent as if you would use it for the root node.
VSHPROPID_ParentHierarchyItemid Nested (shortcut) hierarchies have an invisible node in their parent hierarchy that holds the shortcut to the root node of the nested hierarchy. This property retrieves a System.IntPtr value telling the VSITEMID of the node holding the shortcut. It does not seem logical, but you can use this property for any node in the hierarchy. The property value is the same VSITEMID as if you would use it only for the root node. Please note, this VSITEMID has valid meaning only in the IVsHierarchy of the parent hierarchy.

Furthermore when I use a property identifier I will omit the VSHPROPID_ prefixes from the names as they do not tell too much.

From the table above you can see that handling VSITEMID values is slightly chaotic. FirstChild and FirstVisibleChild use a System.Int32 type while NextSibling, NextVisibleSibling and ParentHierarchyItemId properties use System.IntPtr. As another twist we pass System.UInt32 instances for VSITEMIDs in the property getter and setter methods.