Changing the default Source File Directory in Visu

2019-01-26 03:15发布

This is not a work-stopper in any way, but I thought I should ask anyway because it is a little annoying. Let's say I create a new project and start putting source files in a directory other than the default that shows up the first time. Afterwords, whenever I open the project, I have to navigate to the source directory once during that session. Like I said, not a big deal (but if solvable, then it's icing on the cake). Quite a few times I absentmindedly put the source file in the default directory and end up committing that file to the SVN and if I am lucky, going through all the files, removing them, then adding them again.

So my question is, is there any way to specify the default source directory on a per project basis?

3条回答
家丑人穷心不美
2楼-- · 2019-01-26 03:45

I had the same problem when I started using build systems (CMake, Premake) which requires me to keep my project files separate from my source files, which hampered my workflow.

Although changing the default source directory seems impossible, if you aren't afraid to spend money, the workaround I found was to use the Visual Assist extension.

  • You can bind a shortcut of your choise to the Create File command which creates a new file relative to the directory or your open file.
  • I'd also recommend to base one's workflow around the wonderful Create from Usage command (which I think greatly boosts productivity) which almost eliminates the need to manually create files.

The extension is great, albeit a bit costly. I would love to see Microsoft incorporate these features directly in the IDE eventually as they are found vanilla in a lot of other IDEs e.g. Eclipse, Intellij.

There might be some free extensions available that does the same thing, but I haven't found any.

查看更多
淡お忘
3楼-- · 2019-01-26 04:00

I have run into the same nuisance. I like to put the public interface header files for a library in a separate directory, but end up with file directory typos because I forget to navigate to the correct directory when saving a new file. Unfortunately, Visual Studio does not offer a setting to change the default directory for new C++ source files.

查看更多
等我变得足够好
4楼-- · 2019-01-26 04:05

Changing the Default Project Folder may help. This page demonstrates how to change the default for Visual Studio 2005, and it should be the same for later versions.

查看更多
登录 后发表回答