|
#1
|
|||
|
|||
Adding Steps dynamically...
Hi,
Am Rajiv... I am an amatuer VisualBuild user I need to dynamically generate steps during the build process. To keep it simple, I want to add multiple "Make VS.NET" steps and associated them to the proj file. For now, I have managed to add a new Make VS.NET step to the existing steps. Set steps=Application.Project.Steps(vbldStepMain) steps.Add "Make VS.NET",6 steps.Item(6).Indent=2 Now, I need to set the other properties for the step. I guess, steps.Item(6).Property(ByVal name As String)="<path of .csproj file" For name, I tried "Filename" and it worked. Where can I find a listing of all properities? This code I have added in a "Run Script" action. This will generate the steps and which wil subsequently be built. Is my overall approach correct? Cheers! Rajiv. R Rajspace.Org Last edited by rajivraj; 03-22-2004 at 07:14 AM. |
#2
|
|||
|
|||
You've got it. One thing you could do is store the return value of the Add call and use it to set the properties (a little more efficient and compact):
set objStep = steps.Add("Make VS.NET", 6) objStep.Indent=2 objStep.Property("xyz") = value ... The Script.bld also demonstrates this (Dynamic project section), although it creates the steps in a separate project file and then calls it. To see the properties you need for that action, manually create and populate a Make VS.NET step, then either print/preview the project (ensure that 'Tools | User Options | Printing | Show extended step properties' is checked) to see the custom step property names, or save and then open the .bld file in a text editor and examine the element names within that step. Note that the property names are case sensitive. Also, be aware that when a property is set to its default value (i.e., unchecked for checkboxes, blank for strings, etc.), VBP optimizes the file/step object size by removing those properties. As long as you customize the temporary/manual step in the same way your code will need to generate it, this shouldn't be a problem (you will not need to populate such properties on the dynamic step either). |
#3
|
|||
|
|||
Thanks for that!
To use print-preview for properities is nice tip. Am now facing a weird problem! When I try to build a "Make VS.NET" step which was generated dynamically, I get this error: Object reference not set to an instance of an object. When I go to the step properities, check & uncheck some property (So that the Apply button is enabled) and then click on OK. Now I try to execute this step and I dont get the above listed error!!!!!! Hope I conveyed the issue. Please advice! Regards, Rajiv. R Rajspace.Org |
#4
|
|||
|
|||
Sounds like something is different about your dynamically generated step. Compare the before/after version of the saved step in the .bld file when checking/applying the change from the GUI and see if a property is missing or set incorrectly.
|
#5
|
|||
|
|||
Interesting point!
I noticed in PrintPreview that FileVer and Attr were getting added after applying the change. But even after I added these properties in my dynamic step generation, I got the same error. Next, I noticed that I was setting Config to "release" and wondered if making it "Release" would help! And guess what, it worked ! Then I removed FileVer and Attr properities and it still worked! So the cause was the value of Config. Also, it means that value is case-sensitive too! Thanks. Cheers! Rajiv. R Rajspace.Org |
Thread Tools | |
Display Modes | Rate This Thread |
|
|