简体   繁体   English

嵌套Visual Studio项目以进行选择性共享

[英]Nest Visual Studio Projects for Selective Sharing

This may be a duplicate of Nested projects in multiproject visual studio templates ... 这可能是多项目Visual Studio模板嵌套项目的副本...

I have a Visual Studio solution a solution folder in it to hold all of my projects. 我有一个Visual Studio解决方案其中一个解决方案文件夹,用于存放我的所有项目。 Within that folder are a Windows Phone project, a Windows 8.1 project, and a shared project. 该文件夹中有Windows Phone项目,Windows 8.1项目和共享项目。 This is what VS studio will create when making a Windows 8 Universal App. 这是VS Studio在制作Windows 8通用应用程序时将创建的内容。

I want to expand on this idea and put the windows non-phone code into two child projects, a W8.1 and a W10 project. 我想扩展这个想法,并将Windows非电话代码放入两个子项目,一个W8.1和一个W10项目。 Then have a shared project to hold all of the code except for the stuff not in common. 然后有一个共享项目来保存所有代码,除了不常见的东西。 The whole thing would looke like this: 整个过程看起来像这样:

solution
-windows
--windows.phone
--windows.notphone
---windows.notphone.10
---windows.notphone.8.1
---windows.notphone.shared
--windows.shared

I can't figure out how to do this since shared project and that windows folder under the solution are solution concepts, not project concepts. 由于共享项目以及解决方案下的Windows文件夹是解决方案概念,而不是项目概念,因此我不知道如何执行此操作。

I don't want to target just Windows 10 but I can't figure out another way to target both Windows 8.1 and 10 within the same project. 我不想只针对Windows 10,但我想不出另一种针对同一项目中的Windows 8.1和Windows 10的方法。

Question 1 is; 问题1是; how do I create this project structure in my solution. 如何在解决方案中创建此项目结构。

Question 2 is; 问题2是; how can I instead just have a single windows non-phone project and have it create apps targeted for both 8.1 and 10. I don't mind running the 8.1 app on Windows 10 except that Windows sticks in that extra hamburger button that has nothing in it in my app. 我该如何只拥有一个Windows非电话项目,并创建针对8.1和10的应用程序。我不介意在Windows 10上运行8.1应用程序,只是Windows停留在那个没有任何东西的额外汉堡按钮上在我的应用中

I always find a solution to my problem just after posting the question. 发布问题后,我总是会找到问题的解决方案。 In this case, I realized that the shared project is only shared with those other projects that include it as a reference. 在这种情况下,我意识到共享项目仅与其他包含它作为参考的项目共享。 I can create all of my projects at the same level of the tree, which seems the only way to do this, and then only use the windows-specific shared code in the windows-specific projects. 我可以在树的同一级别上创建所有项目,这似乎是唯一的方法,然后仅在Windows专用项目中使用Windows专用共享代码。 The phone code would not use that windows-specific shared project. 电话代码不会使用该Windows特定的共享项目。

I'd rather have a visible hierarchy though. 我宁愿有一个可见的层次结构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM