proper way to rename solution (and directories) under version control - visual-studio

I have a VS 2015 solution which is under version control with AnkhSVN.
The solution name and one of the projects should be renamed, including the directories.
What is the best way to do this, w/o causing issues with version
control AnkhSVN?
Any good tools available to accomplish this?

I am not very familiar with AnkhSVN, so I can not give a step-by-step guidance. However, you should be able to rename the solution and projects (on disk or in solution config) without issues when you use a Visual Studio plug-in such as AnkhSVN or VisualSVN.
However, you should follow a best practice that will help you prevent tree conflicts after the rename operation: do not perform the refactoring in branches. Perform rename operations and refactoring in trunk (mainline or master).

Related

How to undo any saved or previous file in visual studio?

I want to undo the old project files that I got from my colleague to understand what was created first. Is it possible? Is there any tool for achieving this?
Unfortunately it's not possible. That would only be possible if you colleague had been using a version control system (like Subversion, Mercurial, Git, TFS etc).

Mercurial and Visual Studio

I have a visual studio 2010 project under mercurial. I use mercurial either via command line or TortoiseHG. I want to work on a new feature, so I clone the repo. But now I am confused, am I supposed to import an entire new project into VS2010 just to work on this feature? I tried importing the VS Solution that was cloned, but got lots of build errors from dependencies cannot be found errors, which I assume is because I am trying to load this cloned Solution just like the original Solution and some paths are wrong (no idea where though).
How are you supposed to use mercurial and VS2010?
Cloning produces an exact copy of the original repository.
The clone should work exactly the same way as the original repository, so you open your cloned solution exactly the same way as the original one.
If you get build errors in the cloned solution but not in the original one, there are probably some dependencies (=3rd party assemblies that your application needs to work properly) which exist in the original solution, but weren't committed to the repository.
So, when you clone the repository, the referenced files are missing in the clone...so the clone won't work.
Source control works the best way if you check in the complete solution, including all dependencies:
Make a "Libs" folder somewhere in your solution, put all your dependencies inside, reference those files from your solution and commit the whole "Libs" folder to the repository.
If you do it this way, you can clone the repository from a different machine and open the solution, without worrying about any dependencies...it just works.
It sounds like your root problem is that you're adding references using full paths rather than relative paths. You'll need to rectify that before branching is going to be easy for you. I usually make a "References" folder that is on the same folder level as the .sln file, but one level up from the individual projects, then branch the whole thing.
Example Folder Structure
MySolution
MySolution.sln
References
MyProject1
MyProject2
As for VS integration, I use TortoiseHG combined with VisualHG, it works great.
There is also Mercurial Toolbar
Other tools
This may or may not be related, but I've had to load hotfix KB2286556 in order to get rid of the "Unable to update project dependencies" error from VS2010 when building a fresh checkout of our code. It seems this only happens to setup and deployment projects when compilation is invoked from the command line (such as in our build system), but when it happens it's a very frustrating issue to find the solution for.
Also, VisualHg is a good way to track and invoke versioning from within Visual Studio.
While VisualHG still proves to be a wonderful tool after so many years, I would also suggest HgSccPackage as a very viable alternative for all Visual Studio versions (up to VS2015).
PROS: Stand-alone package (TortoiseHg is not required).
CONS: Doesn't have all the handy features of TortoiseHg such as Git support (which I find incredibly handy to handle GitHub-hosted projects) and Mercurial Keyring.
Both of them are freeware and can be installed through the Visual Studio GUI (Tools > Extensions and Updates...).
For a more extensive comparison between them you can also read this post on my blog.

Why do Version Control Systems lack the sharing functionality of Visual Source Safe and what source control do you use and reckon is worth trying out?

We are looking for a Version Control System to change our current Source Safe one. We are using it along with Visual Studio. We've failed so far - and the main reason for it is that all the alternatives we see doesn't support one or more features of VSS, especially one that we use widely - file share! What's up with that?
Alternatives like Source Gear claim to support them, but I gotta tell you that they do that very poorly. Not to mention that they are way slower than Source Safe, and have even more bugs.
What alternatives we do have to source version systems that do support file share? Or is there a reason to not use features like this? Please share your experience and support your comments.
EDIT:
By Share File I mean that I can checkout a file from any project that is sharing it, do some changes and then all get the latest version. It is very useful when working with C++ projects, or even C# Web Projects. I want to be able to share a file without the need to make another library for that.
From MSDN:
Sharing Files or Projects
Visual SourceSafe has a Share command that allows sharing of files or projects. For use of the command, see How to: Share an Item.
When you request file sharing, Visual SourceSafe creates a shared link between the versions of the file in the projects that share the file. When you check in the file to one of the projects, your changes are automatically checked in to all the sharing projects. All the projects that share a specific file are listed in the Links tab for the file.
When you share a Visual SourceSafe project, you create a completely new duplicate project under the current project. All the files in the new project are shared with the corresponding file copies in the shared project, and changes in one are reflected in the other during check-ins to the Visual SourceSafe database.
Other tools do have similar concepts, though not always with the same name or exactly the same semantics. Off the top of my head:
Subversion externals
MKS SI (shudder) calls them shared sub-projects
I tend to avoid them because it indicates there are some other issues with my project. If the resources are needed across many projects, I package them as a library and set my other projects to depend upon that artifact (using a dependency management tool such as Maven or Ivy to manage the dependencies)
In Subversion, you can share a whole folder (and its subfolders of course) with the svn:external property.
And since version 1.6 you can also share files.
In Git, those are called "submodules" - not sure if they work for single files though.
This post http://blogs.msdn.com/ericlee/archive/2006/07/20/sharing-files-in-team-foundation-server.aspx shows how you can accomplish the same thing with Visual Studio and TFS.
In StarTeam you can share files across projects.
I apologize if this is not really addressing the original question but depending on your will to "change mindset" for which version control system to use I would strongly suggest moving to a distributed one such as Mercurial or Git. There are plug-ins for Windows Explorer and Visual Studio for both.
As to specific features such as VSS-style file sharing I suggest setting up a Continous Integration environment like TeamCity and configure it appropriately.
It's a steep curve at first but awesome and time-efficient once your staff and servers know what to do.

Working with different versions/branches of the same Visual Studio 2005 solution

This is kind of a usability question for using VS2005: I have different branches of the same Visual Studio 2005 solution checked out from version control. The solution and project files are also under version control. On my development workstation, I sometimes have multiple instances of Visual Studio opened on a different version or branch each. They all show up under the same name in the window title and the taskbar, which makes it hard to switch to the correct one etc. (The same goes for the list of recently opened projects in the startup page, but I rarely use that, anyway.)
I tried to find a way to only change the name displayed while not running into too much trouble with source control, but Visual Studio 2005 seems to take the solution name from the name of the SLN file itself, not from some attribute inside of it.
It would already help to have Visual Studio show the full path to the solution file in the title bar, but I haven't found a way to do that, either.
How do you handle different versions from the same solution?
Use the (free) VSCommands plugin:
http://geekswithblogs.net/deadlydog/archive/2011/04/29/friendly-visual-studio-solution-names-for-branches.aspx
I guess it only works when using different folders for different branches (not SVN switching), but still, it's good stuff.
Same issue here. VS has bad support for equally named solutions in different directories.
A somewhat hacky workaround: http://www.helixoft.com/blog/archives/32
There's an ideal extension for your problem, but you must use at least VS 2010:
http://visualstudiogallery.msdn.microsoft.com/f3f23845-5b1e-4811-882f-60b7181fa6d6
It changes the title bar, so must not rename solutions or files.
I know that is an old post, but perhaps you have now a newer VS version :-)
Why don't you rename the solution file on your branches, e.g. MySolution-branchXY.sln?
Update:
I'm not sure I understand your comment.
As soon as you have branched your solution, you have two independent versions of each file: one on the trunk (or source branch) and one on the new branch. The two files simply share a common history, but you are free to change them independently on both branches. So you can rename the solution in your branch.

Using Subversion and Visual SourceSafe in parallel?

In my company, we use SourceSafe and Visual studio. Starting up a minor project, I am eager to try a more modern source control, I am aiming at Subversion. But I need to work with the previous projects in SourceSafe, at least for now.
Q: Will it work well to use both SourceSafe and Subversion in the visual studio IDE? Using what? And are there things in Subversion I may feel painful if I am used to SourceSafe?
Regarding your first question, I don't know of anything that would stop the two working side by side. You can try Ankh for a free SVN VS add-in, or VisualSVN is a commercial option.
Regarding your second question, SVN has a different model than SourceSafe. SourceSafe requires checkout (pessimistic) whereas SVN you just change your files and commit when ready (optimistic). Any conflicts will need to be merged. Other things differ as well, and you should definitely read basic SVN documentation before you start using it. TortoiseSVN provides both excellent Windows shell integration and good doco too.
PS. Once you try SVN in earnest, you will never look back to SourceSafe.
There shouldn't be a problem using Visual Source Safe and Subversion side by side. Visual Source Safe keys off .scc files within the folders. I also believe the source control is stored in the project files. In any event, Visual Studio automagically handles Visual Source Safe integration.
Subversion (TortiseSVN really) stores all it's metadata in .svn folders. When you install Ankh or VisualSVN, these programs target the .svn folders. If you load a project that has .svn folder anywhere in it's folder structure, Ankh or VisualSVN will kick in.
I agree with other posts, once you turn to Subversion you won't want to go back. It takes a little getting use to. Spend sometime, if don't know already, learning merging and branching. It will serve you will moving forward.
After you get subversion up and going, you might want to look into continuous integration. Cruise Control.Net would be a good tool to start.
Best of luck!
Using SVN technically, won't be an issue - especially with Tortoise +VisualSVN (latter not free but cheap).
The headspace change in going from the usual VSS way of working - pessimistic locking - to the SVN/rest of the world style - optimistic locking will be the harder hurdle.
To explain a little less concisely - if you are used to locking a file when you 'check it out' so noone else can change it, or at least everybody else knowing you are working on it before they try to make any modifications it is quite a leap to go over to not knowing until you try to commit - at which point you have to do merges.
Merging is the tricky bit sometimes, purely conceptually, but especially merges for Winforms with the designer auto-code and the resx files...
Think very carefully about your branching strategy. Best to start just working directly off of trunk to get used to the software before deciding to go for merging. You will find a lot of things quite repetitive and manual compared to VSS - we have a coupla guys here who admin the SVN servers and thay have been invaluable in writing scripts and add-ons for Tortoise to take some of the pain away...
In Visual Studio Tools | Options you can select the source control provider from in there. We used to swap between VSS and another provider some years back and all we had to do was change this when we loaded to project.
If you're using SVN, I would highly recommend looking at VisualSVN for integration in Visual Studio. (Although read comments below...)
I've used TortoiseSVN and SourceSafe in parallel with VC6/VB6 projects in order to keep a parallel log of changes with Subversion (for various reasons, but mainly for keeping proper track of revisions) until we were able/prepared to switch fully to Subversion. I had no problems, I only had to keep an eye for new files coming from the SourceSafe repository.
Working with Visual Studio .NET is a different ballgame if you install AkhSVN, which I did. I worked with it for a few months and ran into problems when AnkhSVN automatically kicked-in when opening SourceSafe-controlled projects. Just avoid mixed SVN/SourceSafe projects with VS.NET, or don't install AnkhSVN.

Resources