Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 868
Jan Avatar asked Feb 25 '23 10:02

Jan


2 Answers

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.

like image 102
Christian Specht Avatar answered Mar 02 '23 17:03

Christian Specht


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

like image 35
Brook Avatar answered Mar 02 '23 17:03

Brook