SSAS Helper (Free)
This project is a sample to demonstrate some of the things you can do with SQL Server Analysis Services (SSAS) 2008 and AMO. The SSAS Helper library contains a variety of functions to help bridge the gap between Visual Studio 2008 files and AMO objects.
This functionality in this project has been tested with SQL Server Analysis Services 2008, Visual Studio 2008, and Adventure Works 2008 (as well as several projects I’ve worked on). Always create a backup and validate your results, as your mileage may vary.
Features
The SSAS Helper includes the following functionality:
Name | Description |
DeserializeProject | Reads a SSAS project file and converts the project files (.cube, .dim, .dsv, etc.) into an AMO Database. |
SerializeProject | Write an AMO Database into component project files (.cube, .dim, .dsv, etc.). |
GenerateASDatabaseFile | Write an .ASDatabase file (like Visual Studio creates during a build) from an AMO Database. |
CleanSsasProjectDirectory | Clean “volatile” fields from project files. This functionality facilitates collaborative development. See this blog post for more information. |
SortSsasFile | Reorder the elements in a SSAS project file (.cube, .dim, .dsv, etc.) to make comparison easier. USE THIS FOR COMPARISON/VALIDATION ONLY… it has not been tested for re-use. |
Known Issues and Limitations
The following are known issues/limitations of the sample.
1. Partitions are reordered when De-Serialized/Serialized. Makes it a pain to validate, but I've seen no ill effects. Use SortSssasFile functionality to make a copy of the files for easier comparison.
2. Some fields maintained for Visual Studio (State (Processed, Unprocessed), CreatedTimestamp, LastSchemaUpdate, LastProcessed, dwd:design-time-name, CurrentStorageMode) are lost when a project is De-Serialized/Serialized.
Running the Sample
Use the sample program SsasHelperSampleCli.exe to try out some of the SSAS Helper library features. You can use it with the Adventure Works 2008 AS DB.
Get Help on the Application
Overview
Display the syntax and options for the sample app.
Syntax
SsasHelperSampleCli.exe /?
Example
SsasHelperSampleCli.exe /?
Build a .ASDatabase file from an existing SSAS project
Overview
Build an .ASDatabase file based on a SSAS Project. The .ASDatabase file can be used as input for the deployment wizard, or as part of an automated deployment. This breaks the dependency on Visual Studio to build a project.
Syntax
SsasHelperSampleCli.exe /B [Project File] [.ASDatabase File]
Example
SsasHelperSampleCli.exe /B "C:\Test\enterprise_Build\Adventure Works DW 2008.dwproj" "C:\Test\Test.ASDatabase"
Clean a SSAS Project
Overview
Clean volatile fields used by Visual Studio to maintain the state of a SSAS Project, as well as annotations. Removing these fields make merges easier when multiple developers work on the same SSAS project. See this blog post for more information on this process.
Syntax
SsasHelperSampleCli.exe /C [Project Directory]
Example
SsasHelperSampleCli.exe /C "C:\Test\enterprise_Clean"
Serialize/De-Serialize a SSAS Project
Overview
De-serialize an SSAS Project into an AMO Database object to work with it programmatically, then serialize it back into the component files.
Syntax
SsasHelperSampleCli.exe /S [Project File] [Target Directory]
Example
SsasHelperSampleCli.exe /S "C:\Test\enterprise_Serialize\Adventure Works DW 2008.dwproj" "C:\Test\enterprise_Serialize_Target"
Sort a file
Overview
Sort the nodes and attributes of a given SSAS file. This functionality is useful when comparing the files from two projects looking for differences.
Syntax
SsasHelperSampleCli.exe /O [SSAS File] [Target Filename]
Example
SsasHelperSampleCli.exe /O "C:\Test\enterprise_Serialize\Adventure Works.partitions" "C:\Test\enterprise_Serialize\Adventure Works.partitions.Ordered"
SsasHelperSampleCli.exe /O "C:\Test\enterprise_Serialize_target\Adventure Works.partitions" "C:\Test\enterprise_Serialize_target\Adventure Works.partitions.Ordered"