# Is there a way to specify the vs.net build type using a variable

**URL:** https://www.finalbuilder.com/forums/t/is-there-a-way-to-specify-the-vs-net-build-type-using-a-variable/452
**Category:** Discussion
**Created:** [May 2, 2007, 12:51pm UTC](https://www.finalbuilder.com/forums/t/is-there-a-way-to-specify-the-vs-net-build-type-using-a-variable/452 "2007-05-02T12:51:05Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [May 2, 2007, 12:51pm UTC](https://www.finalbuilder.com/forums/t/is-there-a-way-to-specify-the-vs-net-build-type-using-a-variable/452/1 "2007-05-02T12:51:05Z")

</div>

I’m testing out this software and I can’t seem to figure out how to use a variable to specify the [VS.net](http://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

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [May 2, 2007, 1:42am UTC](https://www.finalbuilder.com/forums/t/is-there-a-way-to-specify-the-vs-net-build-type-using-a-variable/452/2 "2007-05-02T01:42:58Z")

</div>

Hi Elena,  
  
Thanks for your post.  
  
You can set the BuildAction property in the BeforeAction script method of the Build [vs.net](http://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](http://VS.NET) solution in a future version to make it easier to configure via variables, without having to use script.)  
  
Regards,  
  
Angus

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [May 2, 2007, 2:36am UTC](https://www.finalbuilder.com/forums/t/is-there-a-way-to-specify-the-vs-net-build-type-using-a-variable/452/3 "2007-05-02T02:36:17Z")

</div>

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…

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [May 2, 2007, 6:59am UTC](https://www.finalbuilder.com/forums/t/is-there-a-way-to-specify-the-vs-net-build-type-using-a-variable/452/4 "2007-05-02T06:59:58Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [May 2, 2007, 7:09am UTC](https://www.finalbuilder.com/forums/t/is-there-a-way-to-specify-the-vs-net-build-type-using-a-variable/452/5 "2007-05-02T07:09:19Z")

</div>

I also updated to 5.0.0.201 and that did not help.

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [May 3, 2007, 2:56am UTC](https://www.finalbuilder.com/forums/t/is-there-a-way-to-specify-the-vs-net-build-type-using-a-variable/452/6 "2007-05-03T02:56:21Z")

</div>

Hi Elena,  
  
Are you using the Build VC6 action or the Build [VS.NET](http://VS.NET) Solution action? If you are using Build [Vs.NET](http://Vs.NET) Solution, what version of Visual Studio are you building with?  
  
The steps I gave you were intended for the Build [VS.NET](http://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

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [May 3, 2007, 6:36am UTC](https://www.finalbuilder.com/forums/t/is-there-a-way-to-specify-the-vs-net-build-type-using-a-variable/452/7 "2007-05-03T06:36:04Z")

</div>

I am using the build [vs.net](http://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](http://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](http://VS.NET) actions since it didn’t seem to be working.

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [May 4, 2007, 1:20am UTC](https://www.finalbuilder.com/forums/t/is-there-a-way-to-specify-the-vs-net-build-type-using-a-variable/452/8 "2007-05-04T01:20:19Z")

</div>

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

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [May 4, 2007, 1:24am UTC](https://www.finalbuilder.com/forums/t/is-there-a-way-to-specify-the-vs-net-build-type-using-a-variable/452/9 "2007-05-04T01:24:54Z")

</div>

Visual Studio 2005. Email on its way. Thank you.

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [May 4, 2007, 2:40am UTC](https://www.finalbuilder.com/forums/t/is-there-a-way-to-specify-the-vs-net-build-type-using-a-variable/452/10 "2007-05-04T02:40:03Z")

</div>

You have mail. :).

---

<div class="post-metadata">

### Author: ![efridman](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/e/a88e57/32.png) [@efridman](https://www.finalbuilder.com/forums/u/efridman)
#### Post date: [April 28, 2010, 10:25am UTC](https://www.finalbuilder.com/forums/t/is-there-a-way-to-specify-the-vs-net-build-type-using-a-variable/452/11 "2010-04-28T10:25:35Z")

</div>

Hi   
  
 I’m using a variable and the Action.BuildAction to control the action of my “Build [VS.Net](http://VS.Net) Solution” actions and it works OK. But   
  
 In this topic you wrote   
 “(We’re planning on working on the Build [VS.NET](http://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](http://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
