Build VS .NET project

Hi

I read the solution as well as the project names at runtime from a configuration file and want to pass them to the "Build VS.NET Solution" action. Unfortunately I only can specify for the solution file a variable - the project names have to be selected "hard". Is there a simple way to specify the project name dynamically?

Thanks and regards

Hi Gian,

You can set the project names via script, although it’s a little tricky. Here’s an example (you will need FinalBuilder 5 build 130 or newer for this to work):

Put the following script into the BeforeAction script event for the Build VS.NET Solution action (in the script editor tab.) Set the script language to JScript.

For the example, I’m assuming that you have the list of project names as a semicolon-delimited string, stored in a FinalBuilder variable called “ProjectNames”.


Action.SelectedProjects.Clear();

var projNames = ProjectNames.split(";");
for(var i = 0; i < projNames.length; i++)
{
Action.SendLogMessage("Adding project " + projNames[i] + “…”);
Action.SelectedProjects.Add(Action.GetProjectID(projNames[i]));
}


The key function in the script above is Action.GetProjectID() which gets the GUID for each project name.

Hth. Please let me know if you need some more information.

Regards,

Angus

Hi Angus,

 

Thanks for your help.

 

Is there somewhere a complete documentation on these Action methods?

 

Regards,

Gian

Hi Gian,

In the FinalBuilder Help file, there is a topic called “Action Properties and Methods” which lists all of the exposed members of the Action object. There is also one called “Global script functions”, which lists other functions available in the global namespace.

These and other topics can be found under the “Scripting” node in the table of contents.

Hth.

Regards,


Angus

Hi Angus,

 

Yes, I already saw the "Scripting" topics. But I can't see a description for GetProjectID, SelectedProjects, etc.

 

Anyway, I think specifying a Project as a variable in the "Build .NET Solution" action would also help other users. Maybe you could add this issue to the wish list.

 

Thanks again for your help.

 

Regards,

Gian

Hi Gian,

Sorry, I should have read your last question better.

In general, we already have plans to revamp the Build VS.NET action to make it easier to customise. I’ll put a revamp of the action scripting documentation on the to-do list, as well.

The main problem is that at the moment the solution uses the project GUIDs internally, not the names.

Regards,

Angus

i am fairly new to using Final Builder (just started last week), but i think my question is along the same lines of this topic, except I am trying to dynamically build a list of visual C projects.

I have created an XML file containing a list of projects and i am then iterating over that list. for each project i want to call a “Build VC6” action. i am trying to variably set the project .dsw path. i seem to be able to get each project to build, but i cannot get the version info to correctly update for each project… i would like to have the BuildVersion auto increment, but i also don’t necessarily want each dll to have the same version number.

is this possible? can anyone steer me in the right direction? we are using FB 4.0.0.103, but looking to upgrade to 5 soon… hopefully sooner if it will help me with this issue. we currently have a separate final builder project for each and every dll that we build and i’d like to clean things up and make the process more dynamic.

thanks,
mike

Hi Mike,

There are a few ways you can do this. I would do something like this

1) Store the version numbers for each project in the XML file.

2) As you iterate each project, read the version numbers (MajorVersion, MinorVersion, BuildVersion, etc.) from the XML into some FinalBuilder variables.

3) Do one of the following:

- In the BeforeAction script event of the VC6 compiler action, put some script like this:

Action.MajorVersion = MyMajorVersion;
Action.MinorVersion = MyMinorVersion;
Action.ReleaseVersion = MyReleaseVersion;
Action.BuildVersion = MyBuildVersion;


- Alternatively (this is a bit more work), define a Property Set and use the “PropertySet Assign Properties” action to load the version numbers you got from the XML, then set the VC6 compiler action to use that PropertySet. Then, if you want to lock the BuildVersions to the same number for all projects, you could load/save them from an FBD data file using the “PropertySet load from FBD/save to FBD” actions.

Please let us know how you go, or if you’d like some more help.

Regards,


Angus

Thanks for the response!

I would prefer not to have to put the version numbers in the XML file.  I would like to keep them only in the .rc files so that if a developer needs to manually increment the version, they can just do so via Visual Studio, and not have to worry about maintaining the XML file as well.

The solution that I came up with was to add an action before my Build action, which just reads the contents of the .rc file into a Final Builder variable.   Then parse out the version string, specifically the BuildVersion.  Increment it by 1 and then rewrite the .rc file.  Then call the Build VC6 action.

I am using a Create Text File action to overwrite the existing .rc file with the new modified file contents, which are stored in a variable.  I’ve noticed that if the original .rc file happened to have a percent sign anywhere in it, then the Create Text File action fails.  Looks like it is trying to treat the percent sign in the file contents as a Final Builder variable.  Is there anyway I can escape the character somehow?

thanks,
mike

Hi Mike,

Glad you worked out a good solution. You can escape percent signs as %%.

Regards,

Angus