MSMoles and MSBuild RRS feed

  • Question

  • Hello guys!

    I am new to MSBuild and i have some troubles to set it up right to build the Moles assemblies and reference them.

    I tried to instrument the Microsoft.Moles.targets file to get a overview on whats happen in there, but with no success.

    Currently my MSBuild Code looks like that:


    <!-- Properties for custom build -->

    < PropertyGroup >

      < BuildingProject > true</ BuildingProject >

    </ PropertyGroup >

    < Target Name = "AfterBuild ">


        < Message Text = "Start MSMoles... " />

        < CallTarget Targets = "MolesGenerateBeforeBuild " />

    </ Target >

    When i start MSBuild from the VC2010 Console with the right target, it will create the Moles assemblies, but it will not reference them (and it will not move them to the bin-directory).

    I spent the last 2 days on this problem and i can't figure out what i am doing wrong here.

    Has anyone any idea whats the problem here?

    tia, bvoit


    Thursday, December 16, 2010 12:24 PM

All replies

  • This will not work. You can not try to call the MolesGeneateBeforeBuild targets yourself. It should integrate in the build pipeline using the MSBuild extensibility hooks.

    As part of the installation, the Microsoft.Moles.targets should be registered otherwise you could manually import those targets after the 'C#' import statement:

      <import project=".... CSharp..." />
       <import project="...\Microsoft.Moles.targets" />


    Jonathan "Peli" de Halleux - Try Pex online at www.pexforfun.com!
    Monday, January 10, 2011 11:24 PM
  • If we use a build server. What is the best practice to setup Moles on the build server?

    Should we use the moles setup package and thats it or should be use the import project and copy the moles assemblies to the build server?



    Wednesday, February 2, 2011 11:21 AM