I have a simple finalbuilder project set up to build a VS2005 solution file which references 2 projects. Currently this is set to build "All projects in Solution". Is there any way of programmatically changing this setting at runtime to "Selected Projects", and then prompting the user to select which projects to build ?
This project is a simple test for me, and I will need to apply this to a larger one that contains 200+ projects within the solution at a later date.
Unfortunately, this is not something which is particularly easy to do at the moment. We have some new actions on our to-do list which will make this easier, but unfortunately they're not going to be available in the near future.
The crux of the problem is that the Visual Studio action uses the solution project IDs internally, not names, so you need to convert between the project name and the project ID in order to change this list at runtime.
You can do this via script by doing something like this in the BeforeAction event:
Action.BuildType = btSelectedProjects; // Change to "build selected projects" Action.SelectedProjects.Clear; // Clear list of projects Action.SelectedProjects.Add(Action.GetProjectID("ProjectName.csproj")); // Add ProjectName.csproj
The other issue is knowing what the names of the available projects are. At the moment, there is no easy way to extract this information (it's on our to-do list.) My only suggestion would be to define a FileSet which includes the correct project file types (ie *.csproj, *.vcproj, etc.) and then extract the project names using a FileSet to Variable action, then use a Prompt For Variables (Enhanced) action to prompt for which ones to select, and finally pass that result into the Build VS.NET Solution action using script as shown above.
I can mock up a demo project which does this, if you would like to see it, as it's a pretty daunting task for a FinalBuilder newbie. As I said, this is something which we're working on simplifying.
I can mock up a demo project which does this, if you would like to see it, as it's a pretty daunting task for a FinalBuilder newbie. As I said, this is something which we're working on simplifying.
Here's the demo project, as promised. It's a bit kludgey (as I said, a better solution is in the pipeline.)
It works on the following two assumptions:
- All project files are contained in subdirectories of the solution directory
- All project files contained in subdirectories of the solution directory are part of the solution
Also, at the moment it only looks for csproj, vbproj and vcproj files. To add more project types, double-click the 'FileSet Define action', go to the 'Include Patterns' tab, and add new patterns.
The pieces of script which make things happen can be found on the BeforeAction event of the "Build VS.NET Solution" action, and the AfterAction event of the "FileSet to Variable" action.