View Single Post
Old 02-07-2008, 03:34 AM
omar_ita omar_ita is online now
Registered User
Join Date: 08-01-2007
Location: The Roman Empire - Italy
Posts: 7
Thank for your reply.
I just did what you say, following the examples. So I execute Vss History, then get LASTSTEP_OUTPUT value and save it in a temp macro:

set xmlText = vbld_AllMacros.Item("LASTSTEP_OUTPUT")
vbld_TempMacros().Add "VSS_OUTPUT", xmlText

I need to treat the VSS output in a form where user decide if increase version manually or automatically and so on. So I created a C# custom action that takes VSS_OUTPUT as parameter and show a dialog:

<?xml version='1.0' encoding='utf-8'?>
<action DefaultProperty=''>
<GUI Category='Samples' Description='Test action implemented as C# .NET component' Bitmap='NETAction.ico'>
<Tab Name='NET Tab 1'>
<Field Name='VssOutput' Description='VSS History Output' Type='Edit'></Field>

In the C# code, whenever I try to get the parameter value

step.get_ExpProperty(builder, "VssOutput", (short) VarEnum.VT_BSTR);

I always get an empty string or an exception (cannot convert to void or something like that). I tryed ALL VarEnum types. No one works. Obviously if I send a string to custom Action instead of macro (for example "Hello!") then VarEnum.VT_BSTR works well.
If I look in the Macros pane, the VSS_OUTPUT value is <object>. Probably the key is to convert it to a string, isn't it?



I just did a little change and it WORKS!!

set xmlText = vbld_AllMacros.Item("LASTSTEP_OUTPUT")
vbld_TempMacros().Add "VSS_OUTPUT", xmlText

xmlText = vbld_AllMacros.Item("LASTSTEP_OUTPUT")
vbld_TempMacros().Add "VSS_OUTPUT", xmlText

VSS_OUTPUT now is no more an object but a string and I can take it using VarEnum.VT_BSTR

Now using custom action I can do everything I want


Last edited by omar_ita; 02-07-2008 at 03:47 AM.
Reply With Quote