在Visual Studio中合并两个项目并互相访问文件 [英] Merging Two Projects and accessing files from each other in Visual Studio
问题描述
通过右键单击项目名称并选择添加->现有项目选项,我已在现有项目中合并了另一个项目.现在,我将无法从Visual Studio中现有项目(它是C#项目)中访问新添加的项目中的文件,该怎么办?
I have merged another project in my existing project by right-clicking on the project name and selecting Add->Existing project option. Now i wan't to access the files from my newly added project from the existing one in Visual Studio (Its a C# project) , how can i do this?
推荐答案
如果我关注您的问题,那么您有项目A
的解决方案.然后,您添加了一个现有项目B
.
现在,您要从B
中的A
访问文件.如果是这种情况,请右键单击B -> References
并添加对项目A
的引用.现在,您可以使用该项目中的文件了.
If I'm following your question, you had a solution with a project A
. You then added an existing project B
.
You now want to access a file from A
in B
. If that's the case, right click on the B -> References
and add a reference to project A
. Now you can use the files from that project.
根据您的评论,我不确定您是否要拥有单独的项目/文件.如果希望它们只有1,则不应真正添加新项目,而应将项目B
中需要的文件添加到项目A
中.如果要将其保留为包含的其他模块,那么上面的方法适用,但是您需要意识到通常您有一个解决方案,其中包含许多项目.
From your comment, I'm not sure if you want to have a separate project / file. If you want them to be only 1, you shouldn't really add a new project, you should add to your project A
the files you need from project B
. If you want to keep it as a different module that is included, then the above holds, but you need to realize that usually you have one solution, with many projects inside of it.
这篇关于在Visual Studio中合并两个项目并互相访问文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!