导航

yaosansi's Blog

当你背向太阳的时候,你只会看到自己的阴影!能力是有限的,努力无限的!

« LINQ to SQL实战(2) 动态LINQ的几种方法LINQ to SQL公共基类-张逸 »

Using SyncToy v2.0 for Web Site Deployment

  • 本站大部分内容从网上收集,收集目的仅供研究、学习。涉及版权或不希望收录您的文章请您及时与我联系。
  • 本站IM群,请自行选择。请各位朋友按照自己喜好加入。加入群后请及时发言,防止被清理。谢谢您的合作!!!
  • QQ群:Y①WEB开发(ASP.NET)号码:7351660 QQ群:Y②WEB开发(ASP+.NET)号码:11864905
  • QQ群:Y③WEB开发(DIV+CSS)号码:16610506 QQ群:Y④WEB开发(JS+AJAX)号码:16143998
  • QQ群:Y⑤WEB开发(新手)号码:12777715 MSN群:yaosansi[at]126.com
原文:http://www.15seconds.com/issue/080926.htm
  • Introduction

    If you're like me, you probably do your best to ensure that the .NET applications you build contain as few external dependencies as possible. Doing so makes them easier to deploy and maintain, since all you need to do is copy the application's files to a new server and you should be good to go. This has come to be know as XCOPY deployment, after the venerable XCOPY command that has been around since the days of DOS.

    These days I actually use ROBOCOPY and batch files instead of XCOPY for most tasks, but the basic concept is the same.

    As great as the XCOPY method of deployment works, it requires that the user be reasonably comfortable using the command line. Recently Microsoft released version 2 of a simple little utility called SyncToy which gives users who prefer a GUI a similar level of functionality. In this article I'll cover the basics of obtaining, installing, and using this useful little tool.

    Installation

    The first step is obviously to get and install SyncToy v2.0. You can download the installation package directly from Microsoft: SyncToy v2.0 (4.2 MB). While you're there, do yourself a favor and give the overview a quick read.

    Once you've downloaded it, the next step is installation. For such a simple utility, the installation seems to have a lot of steps, but there aren't any real options that you need to change... just agree to all the license agreements and keep clicking the "Next" button and you'll be done in a few seconds. There's no need to examine the images below closely... I simply included them to give you an idea of what to expect.

    Microsoft Sync Framework Installation

    Welcome to the SyncToy 2.0 Setup Wizard

    SyncToy 2.0 License Agreement

    Select Installation Folder

    Confirm Installation

    Installing SyncToy 2.0

    Installation Complete

    Customer Experience Improvement Program

    Once you've installed SyncToy v2.0, you should find an icon for it in the "All Programs" folder on your "Start Menu". Click the icon to to run the program.

    Creating a Folder Pair

    When you launch SyncToy 2.0 for the first time, you'll be greeted by the following welcome screen.

    Welcome to SyncToy 2.0 Screen Capture

    Once you're in the SyncToy program the first step is to set up what's called a "Folder Pair". Setting up a "Folder Pair" consists of three steps. The first step is to choose a "Left Folder" and a "Right Folder". SyncToy calls these "Left" and "Right" because, in some configurations, files are copied in both directions. If you're using SyncToy as a replacement for XCOPY (or a similar tool), it's best to think of the "Left Folder" as the source and the "Right Folder" as the destination.

    Create New Folder Pair: Select Folders

    Step two is where you tell the program what you want it to do with the files. There are three options:

    • Synchronize: New and updated files are copied both ways. Renames and deletes on either side are repeated on the other.
    • Echo: New and updated files are copied left to right. Renames and deletes on the left are repeated on the right.
    • Contribute: New and updated files are copied left to right. Renames on the left are repeated on the right. No deletions.

    For backing up files or one way publishing (where you don't need to worry about overwriting changes on the destination) you'll probably want to choose "Echo", but the action you choose will naturally depend on your individual situation.

    Warning: Echo will delete any files present in the destination folder that are not the same as those in the source. I recommend you be very careful to use an empty folder as the "Right Folder" and by all means please check the preview carefully before running a "Folder Pair" configured for Echo. Please be careful when using this option.

    Create New Folder Pair: Choose Actions

    The final step to setting up a "Folder Pair" is giving the pair a friendly name by which you will refer to it later. Choose something short and simple, but descriptive enough so you know what it does.

    Create New Folder Pair: Name Folder Pair

    Here you can see our new "Folder Pair" displayed in SyncToy's main window.

    New "Inetpub Backup" Folder Pair

    Folder Pair Options

    Once you've created your "Folder Pair", you might want to take a look at the available options before you "Run" it for the first time. This is where you can tell SyncToy which files to include and exclude from the copy, if it should move overwritten files to the Recycle Bin, if it should check each file's contents (in addition to their size and timestamp) to determine changes, and other options like that.

    Folder Pair Options

    Preview and Run

    Once you're happy with all the settings, it's time to give your new "Folder Pair" a trial run. Because syncing folders can take some time and can actually delete files, SyncToy includes a "Preview" option which will create a report telling you what it will do without actually performing the syncronization.

    I highly recommend you perform a preview and check to make sure the results are what you expected before you actually run the syncronization for the first time. Once you've run it a few times there's no need to bother with the preview step, but whenever you're not sure it's best to play it safe.

    Folder Pair Preview

    Of particular interest is the "Preview Results" summary near the bottom of the screen which will tell you the number of files that will be affected by each operation as well as the total bytes the syncronization will require.

    Once you're satisfied with the preview results, you simply click the "Run" button and sit back while SyncToy does it's thing.

    Running SyncToy

    SyncToy Completed

    Command Line Execution / Scheduling SyncToy

    I won't go into much detail since the help file does a good job of covering it, but I just wanted to mention that SyncToy 2.0 does include a command-line interface which allows you to script it or schedule it to run automatically. You can find the topics ("Run SyncToy From Command Line" and "Schedule SyncToy") under "SyncToy How To Topics" in the SyncToy help file.

    Conclusion

    I hope this article has given you a quick and easy introduction to Microsoft's SyncToy v2.0. It's a shame they named it SyncToy, because while it may be easy to use, it's actually quite a powerful little program which provides a nice GUI-based alternative to either manually copying files or using the more complex XCOPY or ROBOCOPY.

  • 原创文章如转载,请注明:转载自http://www.yaosansi.com
    订阅本站,阅读更多文章
    • 相关文章:

    发表评论:

    ◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

    Powered By Z-Blog .Theme from Google黑板报 By Washun

    Copyright 2005-2008 yaosansi'site All Rights Reserved.

    感谢Denny·G 为本站提供FTP空间
    辽ICP备05021434号

    Search

    •  

    赞助商广告

    控制面板

    最新评论及回复

    最近发表