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
* chore(sdk): remove unused template zipping, keep VsixTemplateReference
- Remove VsixTemplateZip item type and related targets (VSSDK handles
template packaging natively when Content entries are in manifest)
- Keep VsixTemplateReference for cross-project templates (copies folders
from referenced projects to local ProjectTemplates/ItemTemplates)
- Add proper VSIXSubPath metadata so copied templates are placed at
correct paths in the VSIX
- Update E2E tests: remove PreBuiltZip, add Reference and ReferenceManual
- Update workflow to verify new template reference tests
- Update documentation to reflect simplified template handling
Closes#39
* fix(sdk): include auto-discovered templates in VSIX
Add Content items for auto-discovered project and item templates so they
are included in the VSIX package. The removal of template zipping also
removed the mechanism that added templates to the VSIX, which broke
auto-discovery scenarios.
* docs(templates): clarify SDK handles template packaging
Update documentation to accurately reflect that this SDK includes
template files in the VSIX, not VSSDK. The manifest Content entries
are for VS template registration, not file inclusion.
Copy file name to clipboardExpand all lines: docs/templates.md
+40-55Lines changed: 40 additions & 55 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,19 +6,30 @@ This document explains how to include Visual Studio project templates and item t
6
6
7
7
The built-in VSIX Manifest Designer in Visual Studio cannot enumerate SDK-style projects when adding template assets. This is because the designer uses legacy DTE extenders that are registered for the old project system, not the Common Project System (CPS) used by SDK-style projects.
8
8
9
-
Additionally, SDK-style projects don't define the `TemplateProjectOutputGroup` and `ItemTemplateOutputGroup` MSBuild output groups that VSSDK expects for template assets.
9
+
This SDK provides MSBuild-based template support that works around these limitations by:
10
+
- Auto-discovering templates in standard folders
11
+
- Supporting cross-project template references
12
+
- Providing validation warnings for missing manifest Content entries
10
13
11
-
This SDK provides MSBuild-based template support that bypasses these limitations entirely.
14
+
## How It Works
15
+
16
+
This SDK handles template packaging by:
17
+
18
+
1.**Auto-discovering** templates in `ProjectTemplates/` and `ItemTemplates/` folders
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
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.
12
24
13
25
## Item Types
14
26
15
-
The SDK provides four item types for including templates:
27
+
The SDK provides the following item types for templates:
16
28
17
29
| Item Type | Description |
18
30
|-----------|-------------|
19
-
|`VsixProjectTemplate`| A folder containing a `.vstemplate` file for a project template |
20
-
|`VsixItemTemplate`| A folder containing a `.vstemplate` file for an item template |
21
-
|`VsixTemplateZip`| A pre-built template zip file |
31
+
|`VsixProjectTemplate`| (Auto-discovered) A folder containing a `.vstemplate` file for a project template |
32
+
|`VsixItemTemplate`| (Auto-discovered) A folder containing a `.vstemplate` file for an item template |
22
33
|`VsixTemplateReference`| Reference a template folder from another project |
23
34
24
35
## Auto-Discovery
@@ -45,10 +56,12 @@ MyExtension/
45
56
MyClass.cs
46
57
```
47
58
48
-
With this structure, no additional configuration is needed. The SDK will:
59
+
With this structure, minimal configuration is needed. The SDK will:
49
60
1. Find the templates automatically
50
-
2. Zip each template folder during build
51
-
3. Include the zips in the VSIX at `ProjectTemplates/` and `ItemTemplates/`
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).
52
65
53
66
### Disabling Auto-Discovery
54
67
@@ -71,33 +84,9 @@ To use different folder names:
71
84
</PropertyGroup>
72
85
```
73
86
74
-
## Manual Template Configuration
75
-
76
-
### Folder-Based Templates
77
-
78
-
If your templates are in non-standard locations, add them explicitly:
@@ -217,14 +199,17 @@ To organize templates into subfolders within the VSIX:
217
199
### Templates not appearing in Visual Studio
218
200
219
201
1. Ensure your manifest has the appropriate `<Content>` entries
220
-
2. Check that the template zip files are included in the VSIX (open the .vsix as a zip)
202
+
2. Check that the template folders are included in the VSIX (open the .vsix as a zip)
221
203
3. Verify the `.vstemplate` file has correct `<ProjectType>` or `<TemplateGroupID>`
222
204
4. Reset the Visual Studio template cache: delete `%LocalAppData%\Microsoft\VisualStudio\<version>\ComponentModelCache`
223
205
224
206
### Build errors about missing template folders
225
207
226
208
Ensure the template folder exists and contains a `.vstemplate` file. For `VsixTemplateReference`, verify the `TemplatePath` is correct relative to the referenced project.
227
209
228
-
### Templates in wrong location in VSIX
210
+
### Cross-project templates not working
229
211
230
-
Check the `TargetSubPath` metadata if you're using custom paths. By default, templates are placed directly in `ProjectTemplates/` or `ItemTemplates/`.
212
+
1. Verify the referenced project path is correct
213
+
2. Check that `TemplateType` is set to `Project` or `Item`
214
+
3. Ensure `TemplatePath` points to a folder containing a `.vstemplate` file
215
+
4. The template folder will be copied to your local `ProjectTemplates/` or `ItemTemplates/` folder during build
0 commit comments