Search code examples
msbuildbuildbuild-automationmsbuild-taskfinalbuilder

How to call MSBuild tasks from FinalBuilder?


The only way I see now is to create xml file for MSBuild containing needed tasks invocations and then run MSBuild directly by calling "Execute Program" action. Is there any standard way of doing this using FinalBuilder?


Solution

  • In FinalBuilder 6 you can use a MSBuild Task. However to be honest in our build script I found that using a batch file and the 'Execute Program' to be a better solution.

    Edit: Quickly doing some reading on this topic I now remember why I used a batch file. The FB6 MSBuild action is a little counterintuitive as not all the properties are accessible from the 'default view' and you need to change to the 'property grid'.

    Update: From your comment; if you want to run an individual MSBuild task and not use the 'Execute Program' action then you will need to create your own FB action. I have never created an custom action myself but apparently they are really simple.

    This is the batch file that I used:

    @ECHO off
    SET Action=%1
    SET Configuration=%2
    SET Platform=x86
    SET CommonTools=%VS90COMNTOOLS%
    SET SourceDir=%CD%\..\..
    SET SolutionFilename=Solution.sln
    SET MSBuild=C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe
    
    IF "%Action%" == "" SET Action=Rebuild
    IF "%Configuration%" == "" SET Configuration=Release
    
    :BUILD
    %MSBuild% "%SourceDir%\%SolutionFilename%" /v:m /t:%Action% /p:Configuration=%Configuration% /p:DenEnvDir="%CommonTools%..\IDE\" /p:SolutionDir="%SourceDir%" /p:Platform=%Platform%
    
    :END
    ECHO.
    ECHO ErrorLevel: %ERRORLEVEL%
    EXIT /B %ERRORLEVEL%