user2459106
user2459106

Reputation: 61

publish website in specified path using msbuild command line

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

Upvotes: 3

Views: 13412

Answers (1)

Nicodemeus
Nicodemeus

Reputation: 4083

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

Upvotes: 4

Related Questions