Visual Studio 项目模板 - 由代码填充的 TemplateContent

Visual Studio Project Template - TemplateContent Populated by Code

我正在尝试创建一个 Visual Studio 项目模板,但我不想手动填充 TemplateContent 部分。理想情况下,它会在尝试创建模板的 zip 文件时触发 C# 脚本。我想知道是否有任何内置的钩子可以让你这样做?

I'm trying to create a Visual Studio Project Template but I don't wish to manually populate the TemplateContent section. Ideally it would fire off a C# script when it tries to create the template's zip file. I was wondering if there are any hooks built in to allow you to do this?

据我所知,微软没有提供相关的API来处理TemplateContent部分,但我们知道TemplateContent部分是XML的一个节点。我们可以使用 LINQ to XML.

填充 TemplateContent 部分