3

i want to publish my web site using msbuild command line.my requirement is below mentod

  1. get the latest code from sever and stored in specified folder.this is done by folloing code

    <Target Name="GetSource">
    <Message Text="Checking out trunk into $(SourceDirectory)" />
    <SvnCheckout RepositoryPath="$(SvnCheckoutPath)"
        LocalPath="$(CheckOutPath)"
        UserName="aaa"
        Password="aa">
    
    
      <Output TaskParameter="Revision" PropertyName="Revision" />
    
    </SvnCheckout>
    <Message Text="Have got revision: $(Revision)"/>
         </Target>
    

    i have achived to get update code in specified folder.(1st reqirement is done)

2.build 3.publish to spcific path

so could you please tell me how to achieve 2 and 3 requirement.??

user2459106
  • 61
  • 1
  • 1
  • 8
  • Hope [this answer](http://stackoverflow.com/a/14820935/148271) helps – IsmailS May 30 '14 at 14:41
  • Does this answer your question? [How to Publish Web with msbuild?](https://stackoverflow.com/questions/3097489/how-to-publish-web-with-msbuild) – tmwoods Oct 06 '21 at 17:09

1 Answers1

4

You could create a new target for "Publish" and from a command line, specify the target and include a parameter that contains the path where you'd want to publish the web site.

<Target Name="Publish">
<PropertyGroup>
  <PublishDirectory>$(PublishDirectory)</PublishDirectory>
</PropertyGroup>

<!-- publish logic using a copy files task or custom task goes here -->
</Target>

From a command line, invoke MSBUILD specifying the target to execute and the path to publish:

msbuild.exe /t:Publish /p:PublishDirectory="D:\InetPubExt\HomeApp\"

That should get you started :)

Nicodemeus
  • 4,005
  • 20
  • 23