Skip to content

Commit e0a8624

Browse files
committed
Add obsolete warnings to PowerShell commands
1 parent 0d84d66 commit e0a8624

File tree

5 files changed

+17
-3
lines changed

5 files changed

+17
-3
lines changed

src/Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
<PackageVersion Include="Particular.Approvals" Version="2.0.1" />
6161
<PackageVersion Include="Particular.Licensing.Sources" Version="6.1.0" />
6262
<PackageVersion Include="Particular.LicensingComponent.Report" Version="1.0.0" />
63+
<PackageVersion Include="Particular.Obsoletes" Version="1.0.0" />
6364
<PackageVersion Include="Polly.Core" Version="8.5.2" />
6465
<PackageVersion Include="PropertyChanged.Fody" Version="4.1.0" />
6566
<PackageVersion Include="PropertyChanging.Fody" Version="1.30.3" />

src/ServiceControl.Management.PowerShell/Cmdlets/UrlAcls/AddUrlAcl.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
namespace ServiceControl.Management.PowerShell
22
{
3+
using System;
34
using System.Management.Automation;
5+
using Particular.Obsoletes;
46

7+
[ObsoleteMetadata(Message = "ServiceControl no longer requires URL reservations, so this command no longer functions", ReplacementTypeOrMember = "netsh http add urlacl", TreatAsErrorFromVersion = "7", RemoveInVersion = "8")]
8+
[Obsolete("ServiceControl no longer requires URL reservations, so this command no longer functions. Use 'netsh http add urlacl' instead. Will be treated as an error from version 7.0.0. Will be removed in version 8.0.0.", false)]
59
[Cmdlet(VerbsCommon.Add, "UrlAcl")]
610
public class AddUrlAcl : PSCmdlet
711
{
@@ -11,7 +15,7 @@ public class AddUrlAcl : PSCmdlet
1115

1216
protected override void ProcessRecord()
1317
{
14-
WriteWarning("ServiceControl no longer requires URL reservations, so this command no longer functions. Use the 'netsh http add urlacl' command instead.");
18+
WriteWarning("ServiceControl no longer requires URL reservations, so this command no longer functions. Use 'netsh http add urlacl' instead.");
1519
}
1620

1721
[ValidateNotNullOrEmpty]
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
namespace ServiceControl.Management.PowerShell
22
{
3+
using System;
34
using System.Management.Automation;
5+
using Particular.Obsoletes;
46

7+
[ObsoleteMetadata(Message = "ServiceControl no longer requires URL reservations, so this command no longer functions", ReplacementTypeOrMember = "netsh http show urlacl", TreatAsErrorFromVersion = "7", RemoveInVersion = "8")]
8+
[Obsolete("ServiceControl no longer requires URL reservations, so this command no longer functions. Use 'netsh http show urlacl' instead. Will be treated as an error from version 7.0.0. Will be removed in version 8.0.0.", false)]
59
[Cmdlet(VerbsCommon.Get, "UrlAcls")]
610
public class GetUrlAcls : PSCmdlet
711
{
812
protected override void ProcessRecord()
913
{
10-
WriteWarning("ServiceControl no longer requires URL reservations, so this command no longer functions. Use the 'netsh http show urlacl' command instead.");
14+
WriteWarning("ServiceControl no longer requires URL reservations, so this command no longer functions. Use 'netsh http show urlacl' instead.");
1115
}
1216
}
1317
}
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
namespace ServiceControl.Management.PowerShell
22
{
3+
using System;
34
using System.Management.Automation;
5+
using Particular.Obsoletes;
46

7+
[ObsoleteMetadata(Message = "ServiceControl no longer requires URL reservations, so this command no longer functions", ReplacementTypeOrMember = "netsh http delete urlacl", TreatAsErrorFromVersion = "7", RemoveInVersion = "8")]
8+
[Obsolete("ServiceControl no longer requires URL reservations, so this command no longer functions. Use 'netsh http delete urlacl' instead. Will be treated as an error from version 7.0.0. Will be removed in version 8.0.0.", false)]
59
[Cmdlet(VerbsCommon.Remove, "UrlAcl")]
610
public class RemoveUrlAcl : PSCmdlet
711
{
812
protected override void ProcessRecord()
913
{
10-
WriteWarning("ServiceControl no longer requires URL reservations, so this command no longer functions. Use the 'netsh http delete urlacl' command instead.");
14+
WriteWarning("ServiceControl no longer requires URL reservations, so this command no longer functions. Use 'netsh http delete urlacl' instead.");
1115
}
1216
}
1317
}

src/ServiceControl.Management.PowerShell/ServiceControl.Management.PowerShell.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<ItemGroup>
2929
<PackageReference Include="Microsoft.Extensions.DependencyModel" GeneratePathProperty="true" />
3030
<PackageReference Include="System.Management.Automation" />
31+
<PackageReference Include="Particular.Obsoletes" PrivateAssets="All" ExcludeAssets="runtime" />
3132
</ItemGroup>
3233

3334
<ItemGroup>

0 commit comments

Comments
 (0)