locked
Generated Mole is not happening on Build Server

    Question

  • I am using the latest release of Pex (downloaded today).

    I moled System to get access to WebRequest.Create.  When I moled it a reference of System.Moles was added to my test project.  And a file was added called System.moles.  It has one sub file called System.Designer.cs. 

    This used to mean that it had failed (because the *.Moles.dll and Moles.xml are missing).  But on further investigation it had created the moles in the System.Moles reference that was added.

    I was happy, I created my unit test and checked it in.  But now my build server hates me.  It is giving this error:

         error CS0234: The type or namespace name 'Moles' does not exist in the namespace 'System.Net' (are you missing an assembly reference?)

    I am assuming it is choking on the using System.Net.Moles; line.

    Is there something I need to check in to get this to work on the build server (I use Team Build (TFS 2008))?  I went and looked at the System.Moles reference and its path is C:\Program Files\Microsoft Moles\MolesAssemblies\System\2.0.0.0__B77A5C561934E089\System.Moles.dll  which leads me to believe it is not something I should be checking into source control.  (But I could be wrong)

    I checked and my build server is also running the same version of Pex (0.93.50813.0)

    I also tried logging into my build machine, opening my build project and generating System.Moles on the build machine.  Alas this did not work either (it worked when I had the project open on the build machine, but when I closed it and fired off another build it failed.  (Even though the generated paths were the same.)

    Any Ideas?

    Wednesday, September 08, 2010 7:42 PM

Answers

  • The problem is related to the caching of Moles assemblies (new feature). Most likely, the cache is not properly set up in the build machine which breaks Moles for now. This issue will be resolved with the new upcoming MSBuild support in v0.94.

    Meanwhile, the workaround this issue is to disable the cache by adding DisableCache="true" on the <Moles element node. This will force Moles to generate the Moles assembly locally and check it in into TFS***.

    (*** with MSBuild, we won't have to check in any generated files)


    Jonathan "Peli" de Halleux - Try Pex online at www.pexforfun.com!
    • Marked as answer by Vaccanoll Thursday, September 09, 2010 4:43 PM
    Thursday, September 09, 2010 3:32 PM
    Owner

All replies

  • The problem is related to the caching of Moles assemblies (new feature). Most likely, the cache is not properly set up in the build machine which breaks Moles for now. This issue will be resolved with the new upcoming MSBuild support in v0.94.

    Meanwhile, the workaround this issue is to disable the cache by adding DisableCache="true" on the <Moles element node. This will force Moles to generate the Moles assembly locally and check it in into TFS***.

    (*** with MSBuild, we won't have to check in any generated files)


    Jonathan "Peli" de Halleux - Try Pex online at www.pexforfun.com!
    • Marked as answer by Vaccanoll Thursday, September 09, 2010 4:43 PM
    Thursday, September 09, 2010 3:32 PM
    Owner
  • WOW, I can't wait for v0.94.  That will be very nice.

    I have to say this is a great feature to add in (not having to check in the moles assembly).

    Any idea when the drop for v0.94 expected (rough estimate of course).

    Thursday, September 09, 2010 4:43 PM
  • Within 1 week hopefully.
    Jonathan "Peli" de Halleux - Try Pex online at www.pexforfun.com!
    Thursday, September 09, 2010 11:31 PM
    Owner
  • I got the 0.94 version of Pex and Moles but I'm still having the same issue. The build server does not run the "Moles Build" part this is why the Moles assemblies are not generated.

    Do I need to install Pex and Moles to the build server?

    Thursday, November 18, 2010 11:06 AM
  • We do not track questions that have  been marked as answered. Please open a new thread.
    Jonathan "Peli" de Halleux - Try Pex online at www.pexforfun.com!
    Friday, November 19, 2010 6:24 AM
    Owner