简体   繁体   English

Visual Studio项目备份

[英]Visual Studio Project Backup

Right now I am saving my all visual studio projects in C drive. 现在,我将所有Visual Studio项目保存在C驱动器中。

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. 现在,我想将所有项目的副本保存在其他驱动器中,因此,如果我的C驱动器崩溃了,那么我也可以访问所有项目。

So what is best way for that. 那么什么是最好的方法。

If I just make zip of current projects from C drive and paste it in another drive. 如果我只是从C驱动器中提取当前项目的zip并将其粘贴到另一个驱动器中。

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. 如果我只是从C驱动器中提取当前项目的zip并将其粘贴到另一个驱动器中。

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)/ 软件配置管理 (SCM)。 SC is a tool for maintaining a code repository. SC是用于维护代码存储库的工具。 It works by associating metadata about every source file and any changes you make. 它通过关联有关每个源文件和您所做的任何更改的元数据来工作。

eg 例如

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 与您选择的IDE(VS)或命令行很好地集成

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: 查看:

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. 但是,只有后者会引入工作流程和尽职调查(通过SCM),因此在编写代码时,由于适当的过程和保护措施,您不太可能会丢失信息。

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: 如果出于某些绝对原因,您决定不继续使用SC,而是坚持使用普通的旧文件备份,那么至少请遵循Scott Hanselman(MSFT)的精明之作 ,他在其中谈论文件备份最佳实践:

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. 您关心的任何事物的3份副本 -如果重要的话,还不够两份。
  • 2 different formats - Example: Dropbox+DVDs or Hard Drive+Memory Stick or CD+Crash Plan, or more 2种不同格式 -例如:Dropbox + DVD或硬盘驱动器+ Memory Stick或CD + Crash Plan,或更多
  • 1 off-site backup - If the house burns down, how will you get your memories back? 1个异地备份 -如果房屋被烧毁,如何恢复回忆?

...using apps like CrashPlan . ...使用诸如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. 斯科特很可能会同意他的计划不是针对源代码的,但是按照他的建议,至少您要备份3个文件

See Also 也可以看看

Have a look at Visual Studio Team Services . 看看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. 您可以将代码添加到源代码管理中(如果您是我将使用Git),并在那里免费管理您的项目。

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. 除此之外,VSTS还有很多选择,例如持续集成/持续部署测试 ,项目管理支持,例如使您的项目成为敏捷项目。

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 尝试GitHubbitbucket

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. 您可以使用.zip存档来备份您的工作,但这有点麻烦,并且可能包含许多不需要重新启动并运行的文件(例如,构建输出,nuget包文件夹等)。这会使您的档案archive肿。

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. 通过示例版本控制可以很好地了解什么以及为什么进行查找,其中还包括对不同类型的VCS以及如何执行许多常规任务的比较。

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): 例如,我使用了以下服务,所有这些服务都会为您提供一个免费帐户,有些还会为您提供私人存储库(这样,如果您想要的是随机的公众成员就看不到您的工作) ):

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.). 使用在线提供商将为您提供第三方备份的额外好处-因此,如果磁盘出现故障,您仍将拥有备份,以及VCS将提供的其他好处(能够回滚到特定磁盘时间点,有关更改的注释等)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM