我可以在 Visual Studio 2003 中添加文件并使其指向另一个项目中的现有文件吗?
这是一个关于使用 Visual Studio 2003 的问题。抱歉,严格来说这不是一个编程问题,但它确实以一种相当烦人的方式影响了我的工作。
我有一个包含 3 个不同项目(假设为 MyProgram、UnitTest 和 PerformanceTest)的解决方案,并且有一个文件(假设为 myclass.h)需要在这 3 个项目之间共享。
该文件是在 MyProgram 项目中创建的,现在我想将其添加到其他项目中。
假设我转到解决方案资源管理器,右键单击 UnitTest,然后选择添加 ->从弹出菜单中添加现有项目。
文件 myclass.h 已添加到项目中,但不是指向现有的(解决方案目录)\MyProgram\myclass.h,而是在(解决方案目录)\UnitTest\myclass.h 中创建一个新文件。现在,这意味着每次更改 \MyProgram\myclass.h 时,我都需要将其复制到 \UnitTest\myclass.h,否则该文件不是最新的。
这是 Visual Studio 2003 的“功能”还是我的选项/设置有问题?手动编辑 .vcproj 文件是使链接指向现有文件的唯一方法吗?非常感谢您的帮助。
This is a question about using Visual Studio 2003. Sorry it is not strictly a programming question but it does affect my work in a rather annoying way.
I have a solution with 3 different projects (let's say MyProgram, UnitTest and PerformanceTest), and there is a file (let's say myclass.h) which needs to be shared between the 3 projects.
The file is created in the MyProgram project and now I want to add it to the others.
Say I go to the solution explorer, right click on UnitTest, and select Add -> Add Existing Item from the pop-up menu.
The file myclass.h was added to the project, but instead of pointing to the existing (solution directory)\MyProgram\myclass.h, a new file is created in (solution directory)\UnitTest\myclass.h. Now this means that everytime I change \MyProgram\myclass.h, I need to copy it to \UnitTest\myclass.h or the file is not up to date.
Is this a "feature" of Visual Studio 2003 or have I got something wrong with the options/settings? Is manually editing the .vcproj files the only way to make the links point to an existing file? Thank you very much for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试此操作 - 要创建指向现有项目的链接:
1. 在解决方案资源管理器中,选择目标项目。
2.在“项目”菜单上,选择“添加现有项目”。
3.在“添加现有项”对话框中,找到并选择要链接的项目项。
4.从“打开”按钮下拉列表中,选择“添加为链接”。
http://msdn.microsoft.com/en-us/library/9f4t9t92。 aspx
你的权利 - 那是 2008 年。此链接暗示你想要做的事情是在 VS 2005 中引入的,并且在 2003 年中不可用:
http://blogs.msdn.com/jjameson/archive/2009/04/02/linked-文件-in-visual-studio-solutions.aspx
Try this - To create a link to an existing item:
1.In Solution Explorer, select the target project.
2.On the Project menu, select Add Existing Item.
3.In the Add Existing Item dialog box, locate and select the project item you want to link.
4.From the Open button drop-down list, select Add As Link.
http://msdn.microsoft.com/en-us/library/9f4t9t92.aspx
Your right - that is 2008. This link implies what you want to do was introduced in VS 2005 and is not available in 2003:
http://blogs.msdn.com/jjameson/archive/2009/04/02/linked-files-in-visual-studio-solutions.aspx
添加现有项目用于在 Visual Studio 中向项目添加副本
Add existing item is used to add a copy to the project in Visual Studio