0
votes

I've seen lots of info on the web about this, but nothing clear & specific which seems to address the problem of simply publishing a web service or web site to a specific folder that I specify at build time.

I'm using Nant and Nant Contrib:

 <target name="build" description="builds the service">

        <msbuild project="${buildoutput}\${service.source}\wsMyService.sln" >           
            <property name="Configuration" value="Release" />           
            <property name="PublishDir" value="${buildoutput}\${service.target}\" />            
            <property name="Targets" value="Publish" />
        </msbuild>

    </target>

Can anyone show me how this is supposed to be done. I can change the output folder in the property pages of the project, but I want this to be configurable from Nant so I can specify the path at build time.

2

2 Answers

0
votes

When you call msbuild from the command line, you can pass in strings to assign to msbuild properties. I don't know anything about NAnt, so I assume it has to resort to a calling msbuild.exe. So you can override msbuild properties like this:

MsBuild /property:buildoutput=C:\arbitrary\folder\bin\

These properties specified from the command line override anything you specify in your build files.

0
votes

This is what im currently using to build webservices using msbuild:

<Target Name="BuildWebService">
    <ConvertToAbsolutePath Paths="$(Root)">
      <Output TaskParameter="AbsolutePaths" PropertyName="Root" />
    </ConvertToAbsolutePath>

    <ItemGroup>
      <WebServices Include="$(Root)\services\Solutions\**\*.host.csproj"/>
    </ItemGroup>

  <MSBuild Projects="%(WebServices.FullPath)"
          Targets="Build"
          Properties="WebProjectOutputDir=$(Root)\services\build\WebService\%(RecursiveDir);OutDir=$(Root)\services\build\WebService\%(RecursiveDir)\bin\" />
  </Target>

Hope you can translate to nant easy enough.