MartinHan-6727 avatar image
0 Votes"
MartinHan-6727 asked AnnaXiu-MSFT commented

In item template, how to substitute part of text with project name?

I have an item template,
<v:View x:TypeArguments="local:$safeitemname$Model" x:Name="view"
xmlns:v ="clr-namespace:$safeprojectname$.Visual"
d:DesignHeight="450" d:DesignWidth="800">
However in practice $safeprojectname$ was not replaced. After research I found its only available for project template.

I tried using the Wizard, however, I don't know how to get the project name with the given paramters of IWizard.RunStarted(Object, Dictionary<String,String>, WizardRunKind, Object[]) Method. It is posible to get it via IWizard.ProjectItemFinishedGenerating(ProjectItem), but this method is called after everything are done.

Anther thing I found perhaps useful is an answer in Stackoverflow, Unfortunately I cannot understand it as I don't where where the 'dte' varible come from.

Please tell me how to let my template be able to capture the project name and automatically write into the generated file.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MartinHan-6727 , about using the $safeprojectname$ parameter in item template, please directly report it in Visual Studio Developer Community page. Have a nice day!

0 Votes 0 ·

0 Answers