问题
I'm reorganizing my project in visual studio. I have some .cpp
/.h
files which I want to move into a subdirectory physically. A would like to have the following acts simultaneously:
- File moving on file system
- SVN working copy database updating (with keeping history)
- Visual Studio project file(s) updating
Extra benefits would be nice, like:
- Updating of
#include
directives referring to the file.
Are there any solutions? Best workarounds?
回答1:
This is the proverbial chicken-and-egg dilemma for software developers:
- Do you move/rename your files in Visual Studio first then go back to Windows Explorer and correct all the adds/deletes that should really be renames/moves?
- Or do you rename/move your files in Windows Explorer then go clean up all the introduced compilation errors in Visual Studio?
You already have the solution at hand! Without AnkhSVN if you do your file operations in Visual Studio you already get two of your requirements: updating your VS project and file system synchronization. With AnkhSVN installed, though, you also get your 3rd requirement: it makes the necessary SVN synchronizations as well. All you have left to do is a commit.
回答2:
I found the following description from a cached page in a Google search:
In Windows Explorer, right-click and drag the file from its old location to its new location, then select "SVN move versioned item" from the context menu. This will not only move the actual file itself, but it will also make sure that all the file history stays with it after you check in your changes. Back in Visual Studio, use the Solution Explorer in VS2010 to "exclude from project" the (now-missing) copy of the file in its old location, and then "include in project" the file in its new location. You may need to refresh the view in solution explorer and/or make sure you are viewing all the files by clicking the "Show all Files" icon at the top (next to the refresh icon) in order to see these files.
After you update the namespace to reflect the new location, I recommend using a global find and replace before you try to compile to save yourself a lot of trouble.
Hope this helps.
来源:https://stackoverflow.com/questions/12405538/move-files-in-visual-studio-and-ankhsvn-simultaneously