VS2010 “Add Item” directory change

后端 未结 4 1325
臣服心动
臣服心动 2021-01-18 07:03

Is there any way to change the default directory Visual Studio 2010 uses when you add a source file through Add -> New Item?

相关标签:
4条回答
  • 2021-01-18 07:19

    I know this post is old... but maybe someone will stumble upon it... like I did today...

    I had the same "problem":

    I have a dedicated directory for icons.

    When I need to add an icon to the resource file, Visual studio takes me to "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE"

    To fix the problem, after I "browsed" to the desired folder, I right-clicked the favorites of the "open file" dialog and selected "add current location to Favorites".

    Next time you will get this dialog, you simply have to look for the folder in the favorites, and click it.

    0 讨论(0)
  • 2021-01-18 07:30

    Add New Item simply adds the item based on which project directory you're currently in or have selected in your Solution Explorer. If you want to change where it gets added then select the target location in the Solution Explorer first.

    This behavior is obvious when right-clicking in the Solution Explorer, but it's also the same when using Project -> Add New Item....

    0 讨论(0)
  • 2021-01-18 07:34

    Try going to tools -> options -> Project and Solutions.

    0 讨论(0)
  • 2021-01-18 07:42

    Since my comment seems to be the actual answer, I repost:

    In the toolbar of Solution Explorer, there's a button "Show all files" (or similar, I'm using the German version). This switches the view to directories, rather than filters. In this view, you can right-click on the desired target folder to add items.

    This does not actually change the default directory, but since you have to click somewhere anyway to add an item, this is the easiest approach.

    Note that even when only using Visual C++, I'd recommend the Productivity Power Tools extension, which comes with Solution Navigator. In C++, this is not as powerful as with .NET, but it still has several features that are useful in C++ and can fully replace Solution Explorer.

    0 讨论(0)
提交回复
热议问题