|
#1
|
|||
|
|||
Problem with VisBuild.Interop assembly
I have a C# app I wrote to automate running several build scripts created with Visual Build. Everything is working great. Using code, I'm able to launch Visual Build, load the project and build it getting back log messages perfectly.
My problem is that I would like to create a percent complete based on the current step number and the total number of steps. Should be very easy to do, but the Interop DLL doesn't include the Steps property on the IProject interface so that I can get the count. I think this is a limitation of .NET because its a property that takes an [in] parameter for the type of Steps to return. However a get property in .NET cannot have parameters so it is not accessible. The Object browser does not show the property and trying to use it anyways results in a compiler error. I believe this may be an issue for other properties also, but that's the first one I ran into. Using ildasm.exe on the Interop assembly shows the Steps property and the get_Steps internal method, but neither are exposed to use in my own application because of the limitation. I tried creating my own interop dll and even modifying your type library but I was unable to get it to work. From past experience, if a property needs an [in] parameter, you need to change it to a method instead. I realize this is difficult to do from a COM type library since you don't want to break backward compatibility. Do you have any suggestions for getting this to work? Thanks, Mike Ballou |
#2
|
|||
|
|||
I'm not aware of any limitations calling COM properties that take parameters from .NET (in fact, the NETAction sample user action does this to retrieve step properties). The IProject.Steps property is defined as the interface's default method, so in the RCW it is exposed as the default indexer property, and accessing it like this from C# worked for me:
builder.App.Project[StepTypeEnum.vbldStepMain].Count |
#3
|
|||
|
|||
Thanks for the quick reply. I saw the default indexer property in the Object Browser but I didn't realize that was the Steps property. Just seemed strange that there is no property named Steps in the IProject interface of the Interop DLL.
Your solution works fine though. Thanks for the help. Mike Ballou |
Thread Tools | |
Display Modes | Rate This Thread |
|
|