Forum Visual Studio

Xamarin Pre/Post Build events


I have defined pre and post build events in some projects using Visual Studio.

When loading the solution in Xamarin Studio (Mac) these events are raised but of course, failed because there are CMD-based.

These events don't seem to appear in the Xamarin Studio Preferences. Is there any way to disable them in Xamarin Studio?



  • RobertoManganoRobertoMangano CHMember ✭✭

    I have the same problem too.
    Any idea @JamesMontemagno ??

  • RobertoManganoRobertoMangano CHMember ✭✭

    ok i found the way:

    in xamarin studio, go to build/custom commands. Pick the configuration and device you want and then do for example

    cp -v "${ProjectDir}/ConstantFiles/Prod/config.txt" "${ProjectDir}/ConstantFiles/config.txt"

    Which copies the configuration file of production environment to the path where the app goes to read the configuration.

    I have 4 configurations:


    Otherwise you can specify variables like they already have (Release_Prod;_Release_Dev; and so on) in the COMPILER/Define symbols text entry, and then use them in your code like

    #if _Release_dev_
    MyConstant = "Hey"
    #elif _Release_prod_
    MyConstat = "hi"


  • MichaelEngelmannMichaelEngelmann FRMember ✭✭

    My solution for the problem:

    <Target Name="PreBuild" BeforeTargets="PreBuildEvent">  
        <Exec Condition=" '$(OS)' == 'Windows_NT' " Command="$(SolutionDir)UpdateVersionInfo -v=auto -p=scan" />  

    just add an Condition=" '$(OS)' == 'Windows_NT' " to the exec.
    For the OSX script you can do it just the other way round: Condition=" '$(OS)' != 'Windows_NT' "

Sign In or Register to comment.