@@ -147,7 +147,7 @@ Design-time T4 text templates let you generate program code and other files in y
147
147
148
148
``` csharp
149
149
150
- < #@ template debug = " false" hostspecific = " false" language = " C#" #>
150
+ < #@ template debug = " false" hostspecific = " false" language = " C#" #>
151
151
< #@ output extension = " .cs" #>
152
152
< # var properties = new string [] {" P1" , " P2" , " P3" }; #>
153
153
// This is generated code:
@@ -219,7 +219,7 @@ Design-time T4 text templates let you generate program code and other files in y
219
219
220
220
```csharp
221
221
222
- <# var properties = File .ReadLines (" C:\\ propertyList.txt" );#>
222
+ <# var properties = File .ReadLines (" C:\\ propertyList.txt" );#>
223
223
.. .
224
224
< # foreach (string propertyName in properties ) { #>
225
225
.. .
@@ -264,12 +264,13 @@ Design-time T4 text templates let you generate program code and other files in y
264
264
The type of `this .Host ` (in VB , `Me .Host `) is `Microsoft .VisualStudio .TextTemplating .ITextTemplatingEngineHost `.
265
265
266
266
### Getting data from Visual Studio
267
- To use services provided in Visual Studio , set the `hostSpecific ` attribute and load the `EnvDTE ` assembly . You can then use IServiceProvider .GetCOMService () to access DTE and other services . For example :
267
+ To use services provided in Visual Studio , set the `hostSpecific ` attribute and load the `EnvDTE ` assembly . Import ` Microsoft . VisualStudio . TextTemplating `, which contains the ` GetCOMService ()` extension method . You can then use IServiceProvider .GetCOMService () to access DTE and other services . For example :
268
268
269
- ```scr
269
+ ```src
270
270
< #@ template hostspecific = " true" language = " C#" #>
271
271
< #@ output extension = " .txt" #>
272
272
< #@ assembly name = " EnvDTE" #>
273
+ < #@ import namespace = " Microsoft.VisualStudio.TextTemplating" #>
273
274
< #
274
275
IServiceProvider serviceProvider = (IServiceProvider )this .Host ;
275
276
EnvDTE .DTE dte = (EnvDTE .DTE ) serviceProvider .GetCOMService (typeof (EnvDTE .DTE ));
0 commit comments