Ancient Cube

Automating build of Analysis Services Projects

As you may be aware, an Analysis Services project consists of the following files:

  • A project file (*.dwProj)
  • One or more  Data sources (*.ds)
  • One or more Data source views (*.dsv)
  • A database file (*.database)
  • One or more cube files (*.cube) with their partition (*.partitions)
  • One or more dimension files (*.dim)

You can right click the project in Visual Studio and choose "build". What happens now seems to be a lot of called to DLL files executed by the integration between Visual Studio and the Analysis Services. The output of this build is the bin folder in your project directory. This folder contains a database file (*.asdatabase). The .asdatabase file is the one you want – you will see why later.

Unlike other projects – which you can build using their proper compiler (Example: CSC.EXE, VBC.EXE) – Analysis Services does not seem to have a compiler executable.

You could be tempted to run msbuild. Unlike most temptation this will result in disappointment – msbuild does not understand Analysis Services files.

The only way I have found to automate the building of Analysis Services projects is to invoke Visual Studio from the command line. Say you have a project called: MyAsProject.dwProj. To build it and obtain the asdatabase file you execute the following:

devenv MyAsProject.dwProj /rebuild Relase /project MyAsProject

So far so good – now you have automated the createion of the .asdatabase file.

You are not done yet. The asdatabase file provides the input to the Analysis Services Deployment Wizard. The spell cast by this wizard allows you to transform an asdatabase filen into an XML/A file. This XML/A file can be run on your deployment target – which will create the cube database.

From the command line the Deployment Wizard can be run in two modes.

The answer mode:

Microsoft.AnalysisServices.Deployment.exe /a

In this mode, you get to choose all the server specific settings and write them back to your bin directory. Check out the BOL documentation to find out exactly how this is implemented (You will find no defense for the naming of the executable in the documentation)

Once you have your answers stored (which you will only do once) you want to automate the creation of the XML/A file. Execute:

Microsoft.AnalysisServices.Deployment.exe MyAsProject.asdatabase /d /o:MyProject.xmla

Voila! You have your xmla file, which you can copy to your deployment target and run. By the way. xmla files can be run from the command line using ascmd.exe which you can find here: http://msdn2.microsoft.com/en-us/library/ms365187….

  No Comments

  1. Göran Israelsson   •  

    If you’re using Windows 7 to build dwproj from command line you may have to start the command prompt as Administrator

  2. Pingback: Creating Dynamic OLAP cubes from Custom Field data, pt. 2 | Microsoft Enterprise Technologies

  3. Pingback: Mobilo » Blog Archive » SSAS: Automatyczny deployment projektu na serwer

  4. Unknown   •  

    Basically the same comment from me. devenv.exe could have taken me a while to figure that one out

  5. Arjun   •  

    Thomas – awesome post!  Didn’t realize I could use devenv.exe … I got scared when msbuild blew up on my solution file.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">