I'm wondering if its possible to set up and share an entire folder of source code between multiple projects in Visual Studio 2012 like how eclipse lets you use multiple source folders. I'm currently developing an entity framework model for a game I'm making with split server and client code, said framework currently sits in a class library referenced by both projects.
我想知道是否有可能在Visual Studio 2012中的多个项目之间设置和共享整个源代码文件夹,就像eclipse允许您使用多个源文件夹一样。我正在为我正在使用拆分服务器和客户端代码制作的游戏开发一个实体框架模型,所述框架目前位于两个项目引用的类库中。
The reason I'd like to use a shared code folder instead is to add code to each entity component type by declaring the classes in the shared folder as partial and having another partial class in the client/server projects that adds sided functionality. I thought that achieving this would be more useful than extending each component on both sides, and it would also eliminate the need to have a DLL included with the product.
我想使用共享代码文件夹的原因是通过将共享文件夹中的类声明为部分类并在客户端/服务器项目中添加另一个添加了侧面功能的部分类来向每个实体组件类型添加代码。我认为实现这一点比扩展双方的每个组件更有用,而且它也不需要在产品中包含DLL。
2 个解决方案
#1
1
you can add a project to your solution (right click Solution -> Add -> Existing Project) and reference it (right click on your project -> Add Reference -> Solution -> Projects -> "Project you want to reference")
您可以将项目添加到您的解决方案(右键单击解决方案 - >添加 - >现有项目)并引用它(右键单击您的项目 - >添加参考 - >解决方案 - >项目 - >“您要引用的项目”)
#2
0
You can right click on a project and select - Add
- Existing item...
. Within the open file dialog select the desired file, click on the arrow next to the Add
button and afterwards on Add As Link
您可以右键单击项目并选择 - 添加 - 现有项....在打开文件对话框中选择所需文件,单击添加按钮旁边的箭头,然后单击添加为链接
OpenFileDialog with Add As Link option http://www.modbusdriver.com/appnotes/images/addaslink.png
带有Add As Link选项的OpenFileDialog选项http://www.modbusdriver.com/appnotes/images/addaslink.png
#1
1
you can add a project to your solution (right click Solution -> Add -> Existing Project) and reference it (right click on your project -> Add Reference -> Solution -> Projects -> "Project you want to reference")
您可以将项目添加到您的解决方案(右键单击解决方案 - >添加 - >现有项目)并引用它(右键单击您的项目 - >添加参考 - >解决方案 - >项目 - >“您要引用的项目”)
#2
0
You can right click on a project and select - Add
- Existing item...
. Within the open file dialog select the desired file, click on the arrow next to the Add
button and afterwards on Add As Link
您可以右键单击项目并选择 - 添加 - 现有项....在打开文件对话框中选择所需文件,单击添加按钮旁边的箭头,然后单击添加为链接
OpenFileDialog with Add As Link option http://www.modbusdriver.com/appnotes/images/addaslink.png
带有Add As Link选项的OpenFileDialog选项http://www.modbusdriver.com/appnotes/images/addaslink.png