October 11, 2009

New installer: Install.bat

Likely, you don't know that I like .bat files ;) Obviously, not because they're good as programming language (they're really bad!), but because they provide petty flexible ways of doing various management tasks. Initial learning curve here is tiny, but you must write lots of them to be a ".bat magician".

Ok, let's return back to the post title. Today I wrote a .bat file handling the whole DO4 installation! So you can take our repository snapshot, run it, and... VoilĂ : everything works. XCopy + Install.bat.

All you need to get DataObjects.Net checked out, compiled and installed after its shortcoming appearance at Google Code is:
hg clone https://dataobjectsdotnet.googlecode.com/hg/ DataObjects.Net
call "DataObjects.Net\Install\Install.bat" -a -b
  • -a option here implies all installation procedures must be performed rather than just basic one. The "Install.bat -?" output below explains this.
  • -b option means DataObjects.Net must be built as well.
The output of Install.bat in this case is:
C:\My Projects\Svn>"Xtensive\Install\Install.bat" -a -b
Updating .NET assembly folders:
  Adding paths to DataObjects.Net binaries and components.
Installing Visual Studio .NET project templates:
  Visual Studio .NET 2008 paths:
    Binaries:  C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\.
    Templates: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates
  Installing CSharp templates for Visual Studio .NET 2008:
    Adding template: Console
    Adding template: Model
    Adding template: UnitTests
    Adding template: WebApplication
    Adding template: Wpf
  Registering changes in Visual Studio .NET 2008...
Installing DataObjects.Net samples:
  Installing Xtensive.Storage.Samples.AspNet
Can't create 'DO4AspNetSample': virtual folder already exists.
Adding DataObjects.Net help to Visual Studio .NET help collection:
Adding DataObjects.Net .targets to `safe imports':
  Updating registry keys for Visual Studio .NET 2008...
Installing DataObjects.Net environment variable(s):
  Adding: DataObjectsDotNetPath=C:\My Projects\Svn\Xtensive
Note: new settings will affect on new processes,
      but not on the current one!
Building DataObjects.Net:
  Cleaning up...
  Building Core (Release), pass 1 (ensures PostSharp weaver is built)...
  Building Core (Release), pass 2 (ensures Core.Aspacts assembly is built)...
  Building Storage (Release)...
  Building Samples (Release)...
As you see, Install.bat performs all the actions necessary to install or uninstall DataObjects.Net (there is -u switch, or you can use Uninstall.bat).

Its quick reference (Install.bat -?):
Usage: [Un]Install.bat [arguments]
       -u: uninstall everything. The same as typing Uninstall.bat.
       -a: install everything.
           Implies every option except -u and -b.
       -r: add paths to DataObjects.Net assemblies to
           .NET assembly folders. This affects on "Add reference"
           dialog in Visual Studio .NET.
       -t: install Visual Studio .NET templates.
       -s: install samples: create virtual folders, etc.
       -h: install help: integrate it into
           Visual Studio .NET help collection.
       -b: build DataObjects.Net, Release configuration.
      -bd: build DataObjects.Net, Debug configuration.
     none: install DataObjects.Net environment variable and
           mark DataObjects.Net .target files as `safe
           to import' in Visual Studio .NET.
Appearance of Install.bat does not imply disappearance of regular installer! It will be nearly the same, but most of actions that were scripted in it earlier are now moved to Install.bat.