Exclude .shfb projects from building in a CI environment

Topics: Developer Forum, Project Management Forum, User Forum
Jan 25, 2012 at 3:39 PM
Edited Jan 25, 2012 at 3:39 PM

Hi,

I've created several SHFB projects in a medium-sized solution, once for each assembly I am developing. My use-case is that we use TeamCity Continous Integration server to automatically build the project every time it's commited to SVN, in debug mode, just to check that the trunk builds. We also have other configurations to build in release and then deploy to the server, etc, but these are on demand, and the continuous is for each commit.

So, I don't want that the doc projects are being build in debug mode on every commit, because it's not necessary and takes a lot of time of server processment. I only want the doc projects to be build when we are publishing the project.

I have created an specific build configuration in VS 2010, that only builds my doc projects, and I've modified "Debug" and "Release" configuration so that they do NOT build the doc projects, as they take some time to build. The Build configuration used in TeamCity is "Debug", so I was expecting that it didn't build the doc projects. But it does. And it lasts a lot, as there are quite a few classes and namespaces to build.

In a regular project, you can avoid building in the Pre-Build event, with a command like 

IF "$(ConfigurationName)"=="Debug" Goto Exit

But there is not such a PreBuild event in a .shfb project, so my question is: Is there any way to tell TeamCity (os MsBuild) not to build .shfb projects, apart from unchecking them from the build configuration, which does not work?

Thanks in advance,
Sergi Gisbert 

Coordinator
Jan 25, 2012 at 4:15 PM

What version are you using? ".shfb" projects are the old 1.7.0.0 pre-MSBuild projects.  The newer versions use an MSBuild-based format and a ".shfbproj" extension.  If you are using the VSPackage for Visual Studio integration and have the projects included as part of a solution, you should be able to use the configuration manager within Visual Studio to tell the solution to exclude the SHFB projects from certain build configurations.  I'm not familiar with Team City so I don't know that options it offers to include or exclude projects from a build.  I know in MSBuild, you can execute other MSBuild tasks and use conditions to specify when they should run based on variables.  I assume Team City will have something similar.

Eric

 

Jan 25, 2012 at 4:30 PM
Hi Eric,

thanks for your quick response.

I'm using the latest version of SandCastle (exactly SHFB v1.9.3.3 Beta 1 (VS2010 Support), downloaded yesterday), and I'm exactly doing what you suggest: having SHFB projects inside the solution and excluding them from building within the configuration manager. This works fine inside VS2010, as it only builds the code projects, and I expected TeamCity to do the same, but it seems to ignore this.

I've tried to manually edit the .shfbproj file and add a prebuild event, but didn't manage to make it work.

TeamCity can build directly a .sln file (my config), or a MSBuild task. I'm not really used to manage MSBuild tasks, so could you point me to an example of a MSBuild script with a prebuild condition that prevents the project from building depending on the selected build configuration?

Thanks a lot,
Sergi

On Wed, Jan 25, 2012 at 5:16 PM, EWoodruff <notifications@codeplex.com> wrote:

From: EWoodruff

What version are you using? ".shfb" projects are the old 1.7.0.0 pre-MSBuild projects. The newer versions use an MSBuild-based format and a ".shfbproj" extension. If you are using the VSPackage for Visual Studio integration and have the projects included as part of a solution, you should be able to use the configuration manager within Visual Studio to tell the solution to exclude the SHFB projects from certain build configurations. I'm not familiar with Team City so I don't know that options it offers to include or exclude projects from a build. I know in MSBuild, you can execute other MSBuild tasks and use conditions to specify when they should run based on variables. I assume Team City will have something similar.

Eric

Read the full discussion online.

To add a post to this discussion, reply to this email (SHFB@discussions.codeplex.com)

To start a new discussion for this project, email SHFB@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Coordinator
Jan 25, 2012 at 9:09 PM

Adding a pre or post build step to the SHFB project won't do anything since they just perform steps before or after the project is built.  Like I said, I don't know anything about Team City so this may be a better question to ask their tech support with regard to getting it to honor the build settings in the solution.  As for executing tasks conditionally, this is one example that uses the MSBuild task to build a SHFB project:

<MSBuild
    Condition="'$(Configuration)' == 'Debug'"
    Projects="$(SolutionRoot)\src\MyProjectHelp.shfbproj"
    Properties="Configuration=Release;Platform=AnyCPU;OutDir=$(OutDir)" />

There may be other ways of achieving the same result using other MSBuild conditional constructs.

Eric

 

Jan 25, 2012 at 10:22 PM
Hi Eric,

You are right, a prebuilt event is useless. I guess I might ask
TeamCity support why it's building a project which is not selected in
the build configuration.

Thanks for your sample. Finally, I've decided to move the SHFB
projects to their own solution, so I can easily trigger it's build in
the CI only when I need it. I think it's the easiest workaround for
this case.

Thanks for your help.
Sergi