I am writing a custom scaffolder for our project. And this scaffolder should add links to DTO declarations for client side app.
I have a possibility to retrieve an instance of project item,
$folder = Get-ProjectFolder "Views\Shared"
and I already found that it is possible to add links using ProjectNode.AddNewFileNodeToHierarchy(string, string) method.
I can get a reference to the DTE service by simply accessing $DTE
variable predefined in PowerConsole.
The question is how to get instance of ProjectNode I am interested in?
Ok, it was easier than I thought.
Here is a snippet I finished with:
$targetFolder = Get-ProjectFolder "Services" -Project "ServiceModel.Silverlight"
$sourceFile = Get-ProjectItem $ServiceInterfaceOutputPath -Project "ServiceModel"
$sourceFile.Open()
$targetFolder.AddFromFile($($sourceFile.Document.FullName))
In case you are not working with t4 scaffolder, this link can be helpfull : http://social.msdn.microsoft.com/Forums/en/vsx/thread/168d23c8-eee8-4486-a412-147b67673593
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With