Visual Studio Project Backup - c#

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.).

Related

Connect Multiple Microsoft Visual Studio to same projects

Me and my couple of friends will start working on a C# database project. We will use Microsoft VS 2015 and SQL Server 2014. Is there any way that our Visual Studio (installed on separate laptop) can connect to the same project?
For example, if one of my friends removes a class from the project, that class should also be removed from our project. Also, if he adds something, that change should also be shown on our VS solution.
If you have db project in Visual studio you should connect it to some version control. After that every change done by your friends will be fetch/pull on your local machine and you will execute the db project. Same is for code changes in your main project. Read about svn and git and choose what is better for you.
Git is a free and open source distributed version control system
designed to handle everything from small to very large projects with
speed and efficiency.
Getting your project on GitHub
Subversion is a free/open source version control system (VCS). That
is, Subversion manages files and directories, and the changes made to
them, over time. This allows you to recover older versions of your
data or examine the history of how your data changed. In this regard,
many people think of a version control system as a sort of “time
machine.”
Subversion can operate across networks, which allows it to be used by
people on different computers. At some level, the ability for various
people to modify and manage the same set of data from their respective
locations fosters collaboration. Progress can occur more quickly
without a single conduit through which all modifications must occur.
And because the work is versioned, you need not fear that quality is
the trade-off for losing that conduit—if some incorrect change is made
to the data, just undo that change.
Some version control systems are also software configuration
management (SCM) systems. These systems are specifically tailored to
manage trees of source code and have many features that are specific
to software development—such as natively understanding programming
languages, or supplying tools for building software. Subversion,
however, is not one of these systems. It is a general system that can
be used to manage any collection of files. For you, those files might
be source code—for others, anything from grocery shopping lists to
digital video mixdowns and beyond.
Importing Data Into A Repository SVN
If you are not aware with git/svn I advise you to use SVN it is easy to understand. Git has his advantages when your team is really big and for open source. Currently on this moment git is the "future" in version controls.
Team Foundation
You can use Team Foundation Version Control (TFVC) to scale from small
to large projects, and by using server workspaces, you can scale up to
very large codebases with millions of files per branch and large
binary files. TFVC is a centralized version control system that lets
you apply granular permissions and restrict access down to a file
level. Because your team checks in all their work into your Team
Foundation server, you can easily audit changes and identify which
user checked in a changeset. By using compare and annotate you can
identify the exact changes that they made.
https://www.visualstudio.com/tfs/
GitLab
GitLab Inc. is a company based on the GitLab open-source project.
GitLab is an application to code, test, and deploy code together. It
provides Git repository management with fine grained access controls,
code reviews, issue tracking, activity feeds, wikis, and continuous
integration.
https://about.gitlab.com/
Bitbucket
Bitbucket is a web-based hosting service for projects that use either
the Mercurial (since launch) or Git (since October 2011) revision
control systems. Bitbucket offers both commercial plans and free
accounts. It offers free accounts with an unlimited number of private
repositories (which can have up to five users in the case of free
accounts) as of September 2010, but by inviting three users to join
Bitbucket, three more users can be added, for eight users in total.
Bitbucket is written in Python using the Django web framework.
https://www.atlassian.com/software/bitbucket

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

Is it feasible to use svn for documents

We need to have documents shared between clients (CRM-like functionality). Users need to be able to:
Edit the documents and save them again
Attach new documents
Our application is coded in WPF with WCF for data-transport and NHibernate/SQL for data on the server.
what we're thinking is to use SVN and have the app create a local check-out of parts of the repository (when they click a document, it is checked out by SVN in the background and opened from the local path) - When saved it will silently (using monitoring of the path) be committed back to the repository.
Question: Is this feasible - or are there better solutions to this?
EDIT 1:
Summary so far:
I'll look into using Git/Mercurial instead of SVN
Document size (revisions) might be prohibitive pending tests
SharePoint is an option (although not viable in my case as the cost alone is prohibitive) - I will look into the alternatives for SharePoint, tho.
Not much experience out there about using repositories for many users although it works for small teams..
Wiki software might be an alternative to SVN.
Thanks for all the feedback - I'll keep it open a bit longer.
EDIT 2:
Summary after a few days of work - I have a client working - see my progress here.
Based on the heavy .NET references, are you all set up with MSDN? Perhaps you can make use of SharePoint...which may already be included within your MSDN account.
You might also want to consider using a Wiki for document management - I've seen this done and do it myself for my own organisation. We're using Atlassian's Confluence Wiki. Confluence provides for the versioning and general management of documents.
I wouldn't use SVN for this, SVN is not very efficient when dealing with binary files. By using SVN as a back channel for some content in your application you just complicate things by adding another technology and dependency, but you will not use much of its real potential.
I would store the documents as blobs in the database and get/store them through WCF.
Generally I don't think that SVN or any version control system is a good thing to use for sharing documents. Main disadvantage is the diff system on binary files... Your SVN repo will grow rapidly..
Maybe you should try using some of the commercial tools designed for document sharing (eg. Microsoft Sharepoint). Or some Open Source alternatives... Perhaps you should read this post...
It depends on the kind of documents you are using. If you have lots of changing, compressed binary files, then don't use it.
However, if the documents are in an open format like a Wiki language, (X)HTML, LaTeX or uncompressed ODF, then using a version control system makes absolutely sense. Also, a bunch of compressed ODF files or PDF files are handled very well, especially if the files are mostly smaller than 5 MB or so.
In addition, make sure to check some more recent version control systems like Mercurial and Git before sticking to the conceptually outdated SVN. In your scenario, you won't profit much from the "distributed" part of Mercurial and Git, but they are nevertheless easier to setup - at least to my experience. And they provide very advanced version control features which can save your day in the rare cases when you need them.
In case you stick to SVN, and if your client software runs under a modern Unix system, you can also try SVN-FS. This is a filesystem that uses a remote SVN server. Each read goes to the latest revision. Each write creates a new commit. This seems to be exactly what you wanted to build around SVN.
I think that using ready made and proven tech is great idea. Would like to see it's progress if you really go that way.
I would strongly go AGAINST SharePoint - you'll tie yourself to Microsoft in manners that are hard to describe here. From my point of view, SharePoint is a tech that needs taking care of just for itself.

Categories

Resources