我可以在Visual Studio项目模板中创建“解决方案”级别项吗?

时间:2023-02-09 15:02:11

There's a lot of great information on MSDN dealing with creating Visual Studio templates. I've been specifically working through a Multi-Project Solution (http://msdn.microsoft.com/en-us/library/ms185308(VS.80,printer).aspx)

有关MSDN处理创建Visual Studio模板的很多很棒的信息。我一直在专门研究多项目解决方案(http://msdn.microsoft.com/en-us/library/ms185308(VS.80,printer).aspx)

I have everything working in my template (4 projects + 2 Solution Folders - 1 for Tests, and 1 for Libraries that I'm referencing). I have no problem adding projects, or solution folders through the template, but I've hit a wall trying to add dll's and other resources that are not in a specific project, they are just solution level items.

我的模板中有一切工作(4个项目+ 2个解决方案文件夹 - 1个用于测试,1个用于我正在引用的库)。我通过模板添加项目或解决方案文件夹没有问题,但我试图添加不属于特定项目的dll和其他资源,它们只是解决方案级项目。

Has anyone dealt with this before? Thanks,

以前有人处理过这个吗?谢谢,

2 个解决方案

#1


2  

I have been trying to do the same thing for a while now and have had no luck finding a native way to do it. The way I am doing it currently is having a custom project template that adds the items to the project and then through a VS Wizard associated with that template using convention to move the files to the solution level and removing them from the project level.

我一直试图做同样的事情一段时间,没有运气找到一个本地方式来做到这一点。我目前的方式是使用自定义项目模板将项目添加到项目中,然后通过与该模板关联的VS向导使用约定将文件移动到解决方案级别并从项目级别删除它们。

#2


0  

This hack might be 10 years late, but thought I'd add it anyway. Its less convoluted than creating a VS Wizard to drive the operation of adding solution level items.

这个黑客可能会迟到10年,但我想我还是会添加它。它比创建VS向导更难以驱动添加解决方案级别项目的操作。

Basically I add a dummy project to the multi-project solution template, named "_SharedFiles".

基本上我将一个虚拟项目添加到多项目解决方案模板,名为“_SharedFiles”。

In the other projects that need links to any of these files, I update the [project].csproj to simply refer to the file in the shared files dummy project.

在需要链接到任何这些文件的其他项目中,我更新[project] .csproj以简单地引用共享文件虚拟项目中的文件。

<Link Include="..\_SharedFiles\GlobalAssemblyInfo.cs" />

#1


2  

I have been trying to do the same thing for a while now and have had no luck finding a native way to do it. The way I am doing it currently is having a custom project template that adds the items to the project and then through a VS Wizard associated with that template using convention to move the files to the solution level and removing them from the project level.

我一直试图做同样的事情一段时间,没有运气找到一个本地方式来做到这一点。我目前的方式是使用自定义项目模板将项目添加到项目中,然后通过与该模板关联的VS向导使用约定将文件移动到解决方案级别并从项目级别删除它们。

#2


0  

This hack might be 10 years late, but thought I'd add it anyway. Its less convoluted than creating a VS Wizard to drive the operation of adding solution level items.

这个黑客可能会迟到10年,但我想我还是会添加它。它比创建VS向导更难以驱动添加解决方案级别项目的操作。

Basically I add a dummy project to the multi-project solution template, named "_SharedFiles".

基本上我将一个虚拟项目添加到多项目解决方案模板,名为“_SharedFiles”。

In the other projects that need links to any of these files, I update the [project].csproj to simply refer to the file in the shared files dummy project.

在需要链接到任何这些文件的其他项目中,我更新[project] .csproj以简单地引用共享文件虚拟项目中的文件。

<Link Include="..\_SharedFiles\GlobalAssemblyInfo.cs" />