Forum Visual Studio

Does XS use xbuild against older runtimes?

JimBordenJimBorden USMember ✭✭

Looking at the build output from a .NET 4.5 project vs a .NET 3.5 project, it seems like when targeting .NET 3.5 Xamarin Studio does not use xbuild, but rather just calls mcs, etc on all of the files in the project. Is this true? The reason I ask is because I cannot get Xamarin Studio to execute my "BeforeTargets" tasks in a .NET 3.5 project, but the same XML in a .NET 4.5 project is fine. Furthermore, running xbuild from the command line on the project builds the .NET 3.5 project as expected.

Is there another way to get the BeforeTargets behavior for .NET 3.5 in Xamarin Studio? Really I just need a task to execute (and have it be compatible with Visual Studio!!) before the actual build takes place (specifically I emit a git commit hash, and copy some DLL files from a specified location).


  • mhutchmhutch USMember, Xamarin Team Xamurai

    Check Project Options -> Build -> General -> Use MSBuild Engine.

  • JimBordenJimBorden USMember ✭✭

    That option is checked, but still the build output shows a call to mcs instead of xbuild.

  • mhutchmhutch USMember, Xamarin Team Xamurai

    I just checked, and when I change the framework to 3.5, XS still uses MSBuild/xbuild.

    What version of XS are you using? Would you be able to gist the build output and project file?

  • JimBordenJimBorden USMember ✭✭

    I am using XS 5.9.1 (Build 3). The project file is here ->

    Right now it has custom commands set up to call a makefile. Also you might notice that the GitVersion Target is set to always not run (condition == false) because it has problems with Mono 4. However I will perform the following experiment:

    First I remove the false condition from the Target, and the build will fail as expected with Mono 4:

    error : Error initializing task GitVersion: Could not load file or assembly 'Microsoft.Build.Utilities.v3.5, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

    Then, I will remove the custom build command, and it uses the internal build logic. I get this output

    Two things to note: The first line says "mcs" and I know it is not using xbuild because xbuild should fail. The platform target is "Mono / .NET 3.5"

  • mhutchmhutch USMember, Xamarin Team Xamurai

    The project file has <UseMSBuildEngine>False</UseMSBuildEngine>

  • JimBordenJimBorden USMember ✭✭
    edited June 2015

    Oh, indeed it does. It's committed that way but I've edited it locally.

  • JimBordenJimBorden USMember ✭✭

    I must insist that this problem still exists. .NET 3.5 projects ignore the UseMSBuildEngine setting and simply call into mcs. This causes the need to manually specify in a custom build command to use xbuild (like this). As you can see this project does not contain <UseMSBuildEngine>False</UseMSBuildEngine> so what is going on?

Sign In or Register to comment.