Traverse dimXpert features in a standalone application

Hey there,

I need to develop an application that traverses all dimXpert features in a standalone application, I found this useful example,  http://help.solidworks.com/2010/english/api/swdimxpertapi/Get_DimXpert_Features_and_Annotations_in_a_Model_Example_CSharp.htm

I tried it as a macro first, i tried to run it from solidworks itself and it worked fine, however when i tried to make a standalone application it give a strange typecasting exception, is there something additional I have to use, when I'm developing a standalone application instead of a macro?

DimXpertManager XpertManager = swConf.get_DimXpertManager(true);

Exception    ->>  DimXpertPart XpertPart = (DimXpertPart)XpertManager.DimXpertPart;

"An unhandled exception of type 'System.InvalidCastException' occurred in Anonymously Hosted DynamicMethods Assembly

Additional information: Unable to cast COM object of type 'System.__ComObject' to interface type 'SolidWorks.Interop.swdimxpert.DimXpertPart'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{A7AF9C2D-52E5-40F1-9D6E-C2DFB4BCD203}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."

SolidworksApi macros