多项目Visual Studio模板中的嵌套项目 [英] Nested projects in multiproject visual studio templates

查看:124
本文介绍了多项目Visual Studio模板中的嵌套项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用以下结构创建一个vsTemplate.

I need to create a vsTemplate with the following structure.

ECart -Ecart.csproject -模块-文件夹 -MVC.csproject

ECart - Ecart.csproject - Modules - Folder - MVC.csproject

我们如何在另一个项目中添加一个项目?在这种情况下,ECart是一个Web项目,而MVC是同一项目的Modules文件夹内的另一个项目.

How can we add a project within another project? In this case ECart is a web project and MVC is another project within the Modules folder of the same project.

这是我在模板中尝试的内容-

Here is what I am trying in my template -

<ProjectTemplateLink ProjectName="ECart">
    ECart.vstemplate
</ProjectTemplateLink>
<ProjectTemplateLink ProjectName="Mvc">
    Modules\Mvc\Mvc.vstemplate
</ProjectTemplateLink>

推荐答案

我没有找到一种仅通过修改vstemplate文件来实现此目的的方法,因为vstemplate的架构不支持嵌套的项目结构. 因此,我找到了一种解决方法(尽管不是我喜欢的).我实现了IWizard.我压缩了项目,并在希望项目所在的文件夹结构中添加了zip文件. 在RunFinished方法中,我以编程方式解压缩了项目并将其添加到解决方案结构中.

I did not find a way to do it just by modifying the vstemplate file because the vstemplate's schema was not supporting nested project structure. Hence I found a workaround to do it (not to my liking though). I implemented the IWizard. I zipped the project and added the zip file in the folder structure where I wanted the project to be in. Programatically in the RunFinished method I unzipped the project and added the project into the solution structure.

这篇关于多项目Visual Studio模板中的嵌套项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆