You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/templates.md
+35-15Lines changed: 35 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,10 +17,10 @@ This SDK handles template packaging by:
17
17
18
18
1.**Auto-discovering** templates in `ProjectTemplates/` and `ItemTemplates/` folders
19
19
2.**Including template files** in the VSIX package automatically
20
-
3.**Supporting cross-project template references**for including templates from other SDK-style projects
21
-
4.**Providing validation warnings**if your manifest is missing required Content entries
20
+
3.**Auto-injecting manifest Content entries**so you don't need to manually edit the manifest
21
+
4.**Supporting cross-project template references**for including templates from other SDK-style projects
22
22
23
-
Your manifest must contain `<Content><ProjectTemplate/></Content>` entries for Visual Studio to register and display templates. The SDK includes the template files in the VSIX; the manifest entries tell VS how to find and register them.
23
+
Visual Studio requires `<Content><ProjectTemplate/></Content>` entries in the manifest to register and display templates. The SDK automatically injects these entries when templates are discovered, so you don't need to add them manually.
24
24
25
25
## Item Types
26
26
@@ -56,12 +56,10 @@ MyExtension/
56
56
MyClass.cs
57
57
```
58
58
59
-
With this structure, minimal configuration is needed. The SDK will:
59
+
With this structure, no additional configuration is needed. The SDK will:
60
60
1. Find the templates automatically
61
61
2. Include all template files in the VSIX
62
-
3. Warn if `<Content>` entries are missing from the manifest
63
-
64
-
You need to add the Content entries to your manifest manually (see Manifest Configuration below).
62
+
3. Inject the required `<Content>` entries into the manifest automatically
65
63
66
64
### Disabling Auto-Discovery
67
65
@@ -104,7 +102,29 @@ The `TemplatePath` is relative to the referenced project's directory.
104
102
105
103
## Manifest Configuration
106
104
107
-
Visual Studio requires `<Content>` entries in your `.vsixmanifest` to register templates. Add these to your manifest:
105
+
Visual Studio requires `<Content>` entries in your `.vsixmanifest` to register templates. **The SDK automatically injects these entries** when templates are discovered, so you typically don't need to add them manually.
106
+
107
+
### Automatic Content Injection (Default)
108
+
109
+
When `AutoInjectVsixTemplateContent` is enabled (the default), the SDK:
110
+
1. Creates an intermediate manifest in the `obj` folder
111
+
2. Injects `<ProjectTemplate Path="ProjectTemplates"/>` if project templates are discovered
112
+
3. Injects `<ItemTemplate Path="ItemTemplates"/>` if item templates are discovered
113
+
4. Uses the intermediate manifest for VSIX packaging (your source manifest is never modified)
114
+
115
+
This means your source `.vsixmanifest` does not need a `<Content>` section at all when using templates.
116
+
117
+
### Disabling Auto-Injection
118
+
119
+
If you prefer to manage the manifest Content entries manually, disable auto-injection:
0 commit comments