publish website in specified path using msbuild command line

11,720

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 :)

Share:
11,720
user2459106
Author by

user2459106

Updated on July 25, 2022

Comments

  • user2459106
    user2459106 almost 2 years

    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.??