views:

30

answers:

1

I'm attempting to execute MSBuild from a NAnt script (which is called by CruiseControl.NET). Since I'm calling MSBuild from NAnt instead of CC.NET, I'd like to specify use the XmlLogger so that I can still generate an MSBuild report for CC.NET. This is the nant target responsible for building our solution with MSBuild:

<target name="compile">
    <property name="solution.file" value="${source.dir}\GS3WebSite.sln"/>

    <if test="${not file::exists(solution.file)}">
        <fail message="The solution file (${solution.file}) was not found." />
    </if>

    <mkdir dir="${output.dir}" if="${not directory::exists(output.dir)}" />

    <!-- Specify CC.NET's XML logger -->
    <property name="msbuild.xmllogger"
              value="${ccnet.dir}\ThoughtWorks.CruiseControl.MsBuild.XmlLogger, ThoughtWorks.CruiseControl.MsBuild.dll"/>

    <exec program="${msbuild.dir}\msbuild.exe"
          commandline="${solution.file} /logger:&quot;${msbuild.logger}&quot;"
          workingdir="." failonerror="true" />
</target> 

When this target executes, I receive the following error:

[exec] MSBUILD : error MSB1021: Cannot create an instance of the logger. Could not load file or assembly 'ThoughtWorks.CruiseControl.MsBuild.XmlLogger\,C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

I think this is occurring because of the backslash being inserted before the comma. Is there another way to specify this? Or do I need to escape the comma somehow?

+1  A: 

I think you inverted the order in the logger declaration, that is : AssemblyPath,LoggerName and not LoggerName,AssemblyPath.
Moreover, as far as I know you don't need to specify the logger class if there is only one in the assembly. So you could try

 <!-- Specify CC.NET's XML logger -->
<property name="msbuild.xmllogger"
          value="${ccnet.dir}\ThoughtWorks.CruiseControl.MsBuild.dll"/>
Benjamin Baumann