在 Visual Studio C++ 中将源文件存储在项目文件目录之外2009年
Visual Studio 项目假定属于该项目的所有文件都位于与项目文件相同的目录中,或者位于其下的目录中。
对于特定项目(在非 Visual Studio 意义上),这不是我想要的。我想将 MSVC 特定的文件存储在另一个文件夹中,因为可能还有其他方法来构建应用程序,例如使用 SCons。此外,MSVC 生成的所有内容都会使源目录变得混乱。
示例:
/source
/scons
/msvc <- here is where I want my MSVC-specific stuff
我可以在资源管理器中手动将文件添加到 source
目录,然后在 Visual Studio 中将它们与项目链接。这不是世界末日,但 Visual Studio 试图规定我的项目的文件夹结构让我有点恼火。
我正在查看项目文件的架构,但意识到这很烦人假设是在 IDE 中而不是项目文件的格式。
有人知道比从 source
目录手动将文件链接到项目更简洁的方法来解决这个问题吗?
Visual Studio projects assumes all files belonging to the project are situated in the same directory as the project file, or one underneath it.
For a particular project (in the non-Visual Studio sense) this is not what I want. I want to store the MSVC-specific files in another folder, because there might be other ways to build the application as well, for example with SCons. Also all the stuff MSVC splurts out clutters the source directory.
Example:
/source
/scons
/msvc <- here is where I want my MSVC-specific stuff
I can add the files, in Explorer, to the source
directory manually, and then link them in Visual Studio with the project. It's not the end of the world, but it annoys me a bit that Visual Studio tries to dictate the folder structure of my project.
I was looking through the schemas for the project files but realized that this annoying assumption is in the IDE and not the format of the project files.
Do someone know a neater way to solve this than manually linking files to the project from the source
directory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我有时会使用它,非常确定这就是您想要的:
显示所有文件
选项已打开。mklink /j target source
对于您显示的示例项目结构,您将运行
mklink /msvc/source /source
并且在项目中源目录将显示就像它在项目目录中一样(好吧,实际上是这样)。额外的好处:通过 VS 添加新项目也会自动将它们放入正确的目录中。I use this sometimes, pretty sure it's what you want:
Show All Files
option is on in your solution explorer.mklink /j target source
For the example project structure you show, you'd run
mklink /msvc/source /source
and in the project the source directory will show up as if it was in the project dir (well, actually it is). Additional bonus: adding new items through VS also automatically puts them in the right directory.您可以添加带有这样的链接的文件,它们是可搜索的、可查看的,但如果您尝试更改它们,它们不会签出,并且 Visual Studio 也会将通配符保留在适当的位置:
这位于 .proj 文件内。
You can add files with links like this, they are searchable, view-able, but they do not checkout if you try to change them, also visual studio leaves the wildcards in place:
This goes inside the .proj file.