I’m testing out this software and I can’t seem to figure out how to use a variable to specify the VS.net build type (Build, Rebuild, Clean, ect.). Is there a way to do this? (since I’d rather not have to copy my entire tree structure into an If/Else and go through and change the build type on all of the solutions by hand.)
Thanks in advance for any help
Hi Elena,
Thanks for your post.
You can set the BuildAction property in the BeforeAction script method of the Build vs.net solution action. To get to the script method, click the Script Editor tab on the bottom pane in the FinalBuilder IDE.
You can use syntax like this:
Action.BuildAction = baBuild
(other choices are baRebuild, baClean, baDeploy)
so if you had a variable called “DoRebuild”, which determined whether or not to rebuild an entire solution, then you could write some VBScript like this:
if DoRebuild then
Action.BuildAction = baRebuild
else
Action.BuildAction = baBuild
end if
(We’re planning on working on the Build VS.NET solution in a future version to make it easier to configure via variables, without having to use script.)
Regards,
Angus
Thank you. That was exactly what I was looking for. And now that I know its there, I can think of several things I want to use it for…
I tried this, and it looks like it does not understand the command and always defaults to build. Final Builder 5.0.0.130, my script is:
If UCase(buildtype) = “REBUILD” then
Action.BuildAction = baRebuild
Elseif UCase(buildtype) = “BUILD” then
Action.BuildAction = baBuild
Elseif UCase(buildtype) = “CLEAN” then
Action.BuildAction = baClean
Elseif UCase(buildtype) = “NONE” then
Action.Echo(“Skipping Action”)
SkipAction = True
Else
Action.echo(buildtype + " not recognized")
End if
where buildtype is a string. The SkipAction portion is working properly, but whenever I try buildtype = ‘rebuild’ or ‘clean’ it defaults to build. The help file only mentions BuildAction and baRebuild in the section on Visual C++ 6 Action. I am not using the MSBuild option. Am I missing something?
I also updated to 5.0.0.201 and that did not help.
Hi Elena,
Are you using the Build VC6 action or the Build VS.NET Solution action? If you are using Build Vs.NET Solution, what version of Visual Studio are you building with?
The steps I gave you were intended for the Build VS.NET Solution action, but they should work Build VC6 action as well (apart from baDeploy, which is not supported.) I copy and pasted your script into a VC6 action here, and it seems to work fine.
If you put ‘Action.SendLogMessage buildtype’ at the top of the script, and add some more ‘Action.SendLogMessage’ calls inside each of the If/Then options, then do you see the behaviour that you would expect?
Also, if you look in the log output of the action than do you see /ReBuild or /Clean, as expected?
Thanks.
Regards,
Angus
I am using the build vs.net action. I did step through the script and it seems to be working properly. I also tried your SendLogMessage suggestion and it is going to the correct place in the script. Also, in what I can only excuse as early morning stupidity I also replied to the automatic email that was sent to me be by your previous post (whoops).
The part I’m concerned about is that in the log file for the DBWizard – build %platform% %config% action it says:
buildtype = clean
cleaning
Running C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com with parameters : /build “Release|Win32” “C:\subversion\Server\Trunk\Source\utils\DBWizard\DBWizard.sln”
It’s still calling /build on the solution no matter what the value of buildtype is.
I’m sorry I caused confusion by bringing up the VC6 action bit, I only wanted to point out that the Action.BuildAction function was only mentioned in the documentation in the context of VC 6 actions and I wanted to make sure that it also applied to VS.NET actions since it didn’t seem to be working.
Hi Elena,
Thanks for clearing that up. Could you let me know what version of Visual Studio you are using?
Also, do you think you could please email a copy of your project to support at finalbuilder dot com. Thanks.
Regards,
Angus
Visual Studio 2005. Email on its way. Thank you.
You have mail. :).
Hi
I’m using a variable and the Action.BuildAction to control the action of my “Build VS.Net Solution” actions and it works OK. But
In this topic you wrote
“(We’re planning on working on the Build VS.NET solution in a future version to make it easier to configure via variables, without having to use script.)”
So is that change really done ? ( I have 6.3.0.1916 )
The disadvantage of using Action.BuildAction is that it affects all the “Build VS.Net Solution” actions meaning if I want to run several actions as build and some as rebuild it’s not possible - Unless you can correct me.
Elad