Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Args update on top or Retry Attemps and RetryInterval. #23

Merged
merged 2 commits into from
Jul 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletions WAWSDeploy/DeploymentArgs.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Args;
using Args.Help;
using System.ComponentModel;
using System.Diagnostics;

namespace WAWSDeploy
Expand Down Expand Up @@ -26,34 +28,50 @@ public class DeploymentArgs
/// Gets or sets the password.
/// </summary>
/// <value>The password.</value>
[ArgsMemberSwitch("p", "password", "pw")]
[ArgsMemberSwitch("p", "password", "pw"),
Description("provide the password if it's not in the profile (default: use from the publish settings).")]
public string Password { get; set; }

/// <summary>
/// Gets or sets the allowUntrusted flag
/// </summary>
/// <value>true or false</value>
[ArgsMemberSwitch("u", "allowuntrusted", "au")]
[ArgsMemberSwitch("u", "allowuntrusted", "au"),
Description("skip cert verification (default: false).")]
public bool AllowUntrusted { get; set; }

[ArgsMemberSwitch("d", "deleteexistingfiles", "def")]
[ArgsMemberSwitch("d", "deleteexistingfiles", "def"),
Description("delete target files that don't exist at the source (default: false).")]
public bool DeleteExistingFiles { get; set; }

[ArgsMemberSwitch("v", "verbose", "vb")]
[ArgsMemberSwitch("v", "verbose", "vb"),
Description("Verbose mode (default: false)")]
public bool Verbose { get; set; }

[ArgsMemberSwitch("w", "whatif", "wi")]
[ArgsMemberSwitch("w", "whatif", "wi"),
Description("don't actually perform the publishing (default: false).")]
public bool WhatIf { get; set; }

[ArgsMemberSwitch("t", "targetpath", "tp")]
[ArgsMemberSwitch("t", "targetpath", "tp"),
Description("the virtual or physical directory to deploy to.")]
public string TargetPath { get; set; }

[ArgsMemberSwitch("c", "usechecksum", "cs")]
[ArgsMemberSwitch("c", "usechecksum", "cs"),
Description("use checksum (default: false).")]
public bool UseChecksum { get; set; }

[ArgsMemberSwitch("o", "appoffline", "off")]
[ArgsMemberSwitch("o", "appoffline", "off"),
Description("attempt to automatically take an ASP.Net application offline before publishing to it (default: false).")]
public bool AppOffline { get; set; }

[ArgsMemberSwitch("r", "retryattempts", "ra"),
Description("number of deployment retry attempts in case of failure (default: 5).")]
public int? RetryAttempts { get; set; }

[ArgsMemberSwitch("i", "retryinterval", "ri"),
Description("retry interval in ms between attempts in case of failure (default: 1000).")]
public int? RetryInterval { get; set; }

public TraceLevel TraceLevel
{
get
Expand Down
22 changes: 9 additions & 13 deletions WAWSDeploy/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Diagnostics;
using Args.Help;
using Args.Help.Formatters;
using Microsoft.Web.Deployment;

namespace WAWSDeploy
Expand All @@ -8,24 +9,17 @@ class Program
{
static void Main(string[] args)
{
var model = Args.Configuration.Configure<DeploymentArgs>();
if (args.Length < 2)
{
WriteLine(@"WAWSDeploy version {0}", typeof(Program).Assembly.GetName().Version);
WriteLine(@"Usage: WAWSDeploy.exe c:\SomeFolder MySite.PublishSettings [flags]");
WriteLine(@"Options:");
WriteLine(@" /p /password: provide the password if it's not in the profile");
WriteLine(@" /d /DeleteExistingFiles: delete target files that don't exist at the source");
WriteLine(@" /au /AllowUntrusted: skip cert verification");
WriteLine(@" /v /Verbose: Verbose mode");
WriteLine(@" /w /WhatIf: don't actually perform the publishing");
WriteLine(@" /t /TargetPath: the virtual or physical directory to deploy to");
WriteLine(@" /c /cs: use checksum");
WriteLine(@" /o /AppOffline: automatically take an ASP.Net application offline before publishing to it.");
var help = new HelpProvider();
new ConsoleHelpFormatter().WriteHelp(help.GenerateModelHelp(model), Console.Out);
return;
}

// parse the command line args
var command = Args.Configuration.Configure<DeploymentArgs>().CreateAndBind(args);
var command = model.CreateAndBind(args);

try
{
Expand All @@ -45,7 +39,9 @@ static void Main(string[] args)
command.WhatIf,
command.TargetPath,
command.UseChecksum,
command.AppOffline
command.AppOffline,
command.RetryAttempts,
command.RetryInterval
);

WriteLine("BytesCopied: {0}", changeSummary.BytesCopied);
Expand Down
10 changes: 6 additions & 4 deletions WAWSDeploy/WAWSDeploy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Args">
<HintPath>..\packages\Args.1.1.1\lib\Net40\Args.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.Deployment, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Program Files\IIS\Microsoft Web Deploy V3\Microsoft.Web.Deployment.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
Expand All @@ -57,9 +55,13 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
<None Include="WAWSDeploy.nuspec" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Args">
<Version>1.2.1</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
10 changes: 9 additions & 1 deletion WAWSDeploy/WebDeployHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public DeploymentChangeSummary DeployContentToOneSite(string sourcePath,
bool whatIf = false,
string targetPath = null,
bool useChecksum = false,
bool appOfflineEnabled = false)
bool appOfflineEnabled = false,
int? retryAttempts = null,
int? retryInterval = null)
{
sourcePath = Path.GetFullPath(sourcePath);

Expand All @@ -46,6 +48,12 @@ public DeploymentChangeSummary DeployContentToOneSite(string sourcePath,
if (!string.IsNullOrEmpty(password))
destBaseOptions.Password = password;

if (retryAttempts != null)
destBaseOptions.RetryAttempts = (int) retryAttempts;

if (retryInterval != null)
destBaseOptions.RetryInterval = (int) retryInterval;

var sourceProvider = DeploymentWellKnownProvider.ContentPath;
var targetProvider = DeploymentWellKnownProvider.ContentPath;

Expand Down
4 changes: 0 additions & 4 deletions WAWSDeploy/packages.config

This file was deleted.