manage different verions of a Visual Studio project? - c#

I'm working on the upgrade of my c# visual express 2008 project to a newer version.
How do I manage this without having to copy the whole project directory and work into the copied directory project?

Create a new branch in the source control system that you are using. You can read more about it at Branching and Merging Primer.
If you are not using a source control I suggest you start with subversion. VisualSVN SERVER is an easy way to get started. You can use TortoiseSVN to work with it or visual studio plugins such as ankhsvn or VisualSVN.
You do not really have to install svn server. You can create repository with Tortoise Svn too and use file protocol to connect to it. This means that you can put the repository on your flash drive and query it with you so that you can work from any computer.

Subversion is good, and easy to pick up, but you might also want to consider Mercurial or Git. These are almost as easy to pick up and give you some flexibility in that they are distributed - which I have found makes much more sense for an individual user. These also tend to take up less space in the long run as well.
In addition, for your needs, you will not necessarily need to branch. Get your chosen Source Control installed, and create your repository with your stable version in it. Once you have that, as long as you have a backup in place, you will always be able to get back to your stable version. If you ever have to do a bug fix on your stable version, that would be the time to branch from that version. For a small individual repository, it'll probably be less confusing to keep your main work in the trunk -
Lastly, since you are new to source control, get in the habit of doing one thing at a time, then checking that change in. Your source control tool (or commandline) should be open every time your IDE is, and you should use it often. Even small changes are important to track. Establishing this habit will take work, but will pay off immensely.
Good luck!

Related

Visual Studio Project Backup

Right now I am saving my all visual studio projects in C drive.
Now I want to keep copy of that all projects in some other drive, so if my C drive get crashed then also I can access all projects.
So what is best way for that.
If I just make zip of current projects from C drive and paste it in another drive.
And when needed I extract it, then will it work OR any error will come.
Thanks for help in Advance.
If I just make zip of current projects from C drive and paste it in another drive.
Well you could do that but it's rather tedius; error-prone and rather brute-force. It's difficult to maintain history.
A better choice is to use some form of source control (SC) / software configuration management (SCM). SC is a tool for maintaining a code repository. It works by associating metadata about every source file and any changes you make.
e.g.
Git
Subversion
Microsoft TFS
Perforce
IBM/Rational ClearCase
Microsoft SourceSafe (ewww, retried thankfully)
Source control not only keeps a copy somewhere else (ideally a different computer) but it also allows you to
keep track of what changed
rollback a change
share with your friends or colleges
integrates nicely with your IDE of choice (VS) or command-line
But in this day and age there are plenty of free cloud-based solutions that offer you more than just acting as a code repository such as stats; wikis; bug tracking; and spiffy charts. Check out:
Microsoft Visual Studio Team Services (VSTS)
Github
Atlassian Bitbucket
Summary
Irrespective of whether you perform manual folder copies or use source control; both will lead to a copy of your code. However only the latter introduces workflows and due-diligence (via SCM) so that as you code you are unlikely to lose information due to the procedures and safeguards in place.
A word on file backup
If for some absolute reason you decide not to proceed with SC but rather stick with plain-old-file-backup then at least follow the fine wisdom of Scott Hanselman (MSFT) where he talks about file backup best practices:
I've got a number of backups because I practice the Backup Rule of Three.
3 copies of anything you care about - Two isn't enough if it's important.
2 different formats - Example: Dropbox+DVDs or Hard Drive+Memory Stick or CD+Crash Plan, or more
1 off-site backup - If the house burns down, how will you get your memories back?
...using apps like CrashPlan.
Scott will most likely agree that his plan wasn't intended for source code but at least you have 3 backups of files as he recommends.
See Also
Hanselman, S, "Is your stuff backed up? Recovering from a hardware failure"
Have a look at Visual Studio Team Services. You can add code to source control (I would use Git if I were you) and manage your projects there for free.
Having your code in a source control system has many benefits, like having history of each commit.
Next to that, VSTS has lots of opions like Continuous Integration / Continuous Deployment, Testing, project management support like making your project an Agile project.
What will you do if hard drive crash?
Code Management is a practice and there are many tools to help you to manage your code. Try GitHub or bitbucket
Moreover you can also zip the code and save on external disks but check how much risk is involved with your code.
You could use a .zip archive to back up your work, but this is slightly laborious and will likely include a number of files you do not need to get up and running again (for example the build output, nuget packages folders, etc.) which will bloat your archives.
A better option would be to use a Version Control System of some kind, which will allow you to back up those parts of the project/solution that actually need to be backed up while ignoring the parts that can be rebuilt from the code. A good walk through of what and why can be found in Version Control By Example, which also includes comparisons about different types of VCS as well as how to perform many of the usual tasks.
There are various free options out there, based on a number of different providers. As some examples, I've used the following services, and all of them will give you a free account, and some will also give you private repositories (so that random members of the public can't see your work if that's what you want):
GitHub - unlimited public repositories, uses Git.
BitBucket - unlimited private repositories, uses Git or Mercurial
Visual Studio Team Services - unlimited private repositories, uses Git or TFS
Using an online provider will give you the added benefit of the backups being on a third party - so if your disk fails you'll still have a backup, as well as the other benefits a VCS will provide (the ability to rollback to a specific point in time, annotations about changes, etc.).

C# Solution into SVN projects

Apologies if this has been asked before, but I've been unable to find the information I'm looking for.
I'm working on a large C# solution, which contains a number of components shared with another 2 solutions.
My aim is to check the whole thing into an SVN server, but I'm uncertain the best way to go about this.
When I worked in a Java dev team, we used an SVN server and Maven to handle builds, so our projects were entirely modular.
Each project was checked into SVN as a separate entity, and Maven handled the retrieval of compiled artifacts, and all was well.
I would like to replicate this sort of strategy in C# using VS 2013, but I'm uncertain how to go about this other than checking in each project of the solution into its own SVN project.
This is not an issue as such, but we have 2 other solutions which use projects contained in our main solution.
If I were to check in the entire solution (as I would wish to so the solution files themselves are version controlled), the SVN checkout/checkin could become rather complex and unwieldy.
If I check in individual project from within the solution directory, I will need to come up with an svnignore policy that will stop the projects contained within the solution directory from being checked in to SVN again.
The SVN in this case will not be used for team development, but for handling merges and storing finalised tags, so will be running locally on my machine.
I'm pondering TFS as an alternative, but have no experience with it, so I'm unsure if it can be used in this way.
Can anybody advise if my proposed approach is actually possible for VS projects using SVN, or whether TFS would be a better option?
I would be happy to use an entirely different solution for source control, however I'm less inclined toward using GIT. For the uses we're intending, a more traditional client/server approach would suit out needs better, and the relearning time required for GIT just can't be spared at the moment.
If there are other posts/guides/existing advace on this subject that somebody can point me to, I would be grateful.
Many thanks.
You can achieve it by TFS. Need to check in the entire solution(all in source control) and use local workspace, get the files mapping in local. For VS, all your source code are locally, just like in the local development environment. All your need is editing your code, checking in server, resolving the conflict, getting latest version.You even don't need to manually check out your solution(For local workspace in TFS, will automatically check out files).
Tree view of your project as below.
-Your project
-solution1
-solution2
-Main solution
-common folder(which put the shared components)
You just need to add the common folder associated with the three solutions. Every change in the common folder will also defect with the three other solutions when checked in.

Use Git locally at work in conjunction with custom "source control"

At work, we are required to use a custom "source control" system. Basically, it takes snapshots of our code whenever we push new changes to our live environment. There are no rollback capabilities except to get a copy of the last live push, there are no mechanisms for seeing who changed what, and once one person is working on the code someone else can change the source and you would not know (unless you spotted the change).
I would like to implement Git in this environment but I'm not wise enough in the ways of Git to figure out how best to do this. Here are the requirements that I need to handle:
Source code is stored on a remote file path.
Once I start a project, anyone can change the remote source (I would like to capture these changes if possible).
The source is (usually) existing before I start to work on it.
After I complete a project, someone else may change the source (not using Git).
I am going to attempt to get the rest of my coworkers involved in doing this too.
I have only file read/write access to the remote server.
My coworkers do not like the command prompt (and, quite frankly, I prefer to use a GUI), so use of a GUI (like GitHub for Windows or, even better, the Team Explorer tools inside Visual Studio) would be a high priority.
We are a Windows-only shop specializing in C# and ASP.NET MVC so any solutions would need to work inside those bounds.
The impact on the remote files and folders should be minimal. I know Git is light but anything I can do to keep it as invisible as possible will be great.
I've looked into how to do this but I've not found a good solution that works for me (or at least that I understand would work for me). I found this article but it didn't appear to really work well for my environment (again, maybe that is my lack of understanding):
http://mattsnider.com/develop-locally-using-git-instead-of-your-company-s-crappy-version-control/
Any help that you can give would be much appreciated. I would really appreciate it if the help you give is doable for a Git user (me) who is not very knowledgeable. Steps to follow and instructions on why would be tremendous.
If your employer already has an established version control system that can handle all their different artefacts that the company needs to store (which will be more than just source code) then don't even try to actually change their system.
The question is more about how you can help yourself, which will depend on the level of access you have to personal storage and to network storage - the latter being maintained by others.
Assuming you have local storage, then you can set up a git repository within your own local copy of the source code. You would then set up a remote on a/your network drive to act as your back-up. (as described in the blog you reference).
I use (variously) Git-for-Windows, Git-Gui, gitk, and Git Extensions for my development so that I can pick and mix the best tool/command for any particular task. I find it especially useful for my Matlab development with its rapid interactive edit-fix-update common in (my sort of) systems engineering.
When I have a stable version in a commit, that I want to send back to the company VCS, I can then check it out/back-in (or whatever their process demands) to their system (do tag that commit).
Likewise if there is an update to another file that you need from their VCS you should have a branch for receiving it's checkout, followed by a merge back into your development branch (or whatever flow most suits you).
Regularly push your local repo onto your bare network repo so you have a backup and some security. You can always bundle your repo, or archive a commit as required for other backups if you need.

Make changes to c# program without loosing older code

I'm a hobbyist programmer and I've created an application for my office. Every so often I need to improve the code, add features or fix issues that come up under certain circumstances - I've found bugs or ineffective coding even after 3-4 months of heavy usage of the application. The thing is that whenever I modify the code, visual studio saves the changes. This means that if I want to use the program I'll have to be really fast in coding and debugging or it won't build - and I won't be able to use it...
Is there any way to keep the old version of the program without having to save the complete project folder elsewhere? Like creating a new version but keeping the option to go back to the old - working - one...
What you are looking for is called source control.
There are many systems out there, two popular ones are subversion and Git.
Used properly, you will have a full history of each file you have in your project.
There are two other answers here regarding source control at the time I write this, but there is another angle on this as well.
You're executing your production copy from the development directory. Don't do this.
When you have developed the program to a stable version, make a copy of it somewhere else and use that copy. In this way you're free to keep developing on the software without destroying your ability to keep using the existing stable version.
As for source control, you should definitely use that as well if you're not already doing it. It would, among other things, allow you to go back and hotfix the stable version with minor bugfixes while still doing major rewrites of the software, as well as the features others here have mentioned, full history of your project, "unlimited" undo, etc.
I'm not sure what you mean that Visual Studio saves the code when you modify it. It does by default save when you build, but I don't think it saves while you're typing.
Anyway, what you're looking for is called a source control system.
You can try Team Foundation Service from Microsoft.
It works fine and you can share youre project whit colleagues.
http://tfs.visualstudio.com/
EDIT:
This is a free of charge option you can use, until you want to share youre project with more than 4 persons!! than you have to pay for TFS
You need source control.
If your project is open source you can use codeplex, it's an open-source Website where engineers and computer scientists share projects and ideas. Its features include wiki pages, source control based on Mercurial, Team Foundation Server or Subversion (also powered by TFS), Git,discussion forums, issue tracking, project tagging, RSS support, statistics, and releases
If you don't want to share your code you can use Team Foundation Server

how to manage Project in c# , ASP.NET MVC when i have a new copies and have something feature in it?

i have a project where i do something i have same copy from another who have do something in it later i have a thing to do currently.
so that's three copy and i am unsure that i am not confused with it. sometime i call wrong copy for finding the thing i want from them.
without using any software outside our office window any trick to manage all project or how i can manage them and make them one copy.
the same problem with some other problem come with when the same script used in two software , website who are used same script with have a small difference in both.
so i want to know how exactly all other manage them. i want to have a answer with .net plateform.
There are several source control solutions that have plugins to integrate directly with Visual Studio. I would recommend looking into Subversion. Currently at my office we use Vault, but it has some short comings, especially when it comes to renaming or moving a file and then editing it prior to a check in.
http://ankhsvn.open.collab.net/
http://www.sourcegear.com/vault/
I recently started a small pet project. It's written in C# with ASP.NET MVC3. As it's grown, my needs for source control also has grown. Here's what I've done:
Day one, I placed my project in a Dropbox folder. That way, I could reach my project files from all my computers (and even my iPhone).
A few weeks later, when I first had to make some serious changes and neede a fallback, I created a Mercurial repository in my Dropbox folder and commited all my code. I've got a blogpost on that here: http://csharptutorial.blogspot.com/2011/06/using-dropbox-with-mercurial.html. Mercurial is a great versioning system, because it doesn't require a server installation and your repository is copied in full to all locations where it's checked out.
Now, I'm looking at moving my project over to BitBucket (http://bitbucket.org/) where you also share and discuss code with others.
A good alternative to Mercurial is Git, using github.com in stead of bitbucket.org. Both have a learning curve, but they both represent modern version control tools and is well worth having a look at.
Source control and discipline.
You need to get an approach and method for managing your source. A source control system is essential for this. I use SVN and Ankh, as does Clayton.
However, you need an approach for using this. I always have branches. You can have development branches and merge these changes into a release branch when your code has passed all the tests. This way takes a discipline and time, but you need to do this to build quality into your system.

Categories

Resources