Skip to content

Commit 73a1858

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

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
<PackageReference Include="System.Management.Automation" />
3131
</ItemGroup>
3232

33+
<ItemGroup>
34+
<PackageReference Include="Particular.Obsoletes" PrivateAssets="All" ExcludeAssets="runtime" />
35+
</ItemGroup>
36+
3337
<ItemGroup>
3438
<Artifact Include="$(OutputPath)" DestinationFolder="$(PowerShellModuleArtifactsPath)" />
3539
<Artifact Include="$(PkgMicrosoft_Extensions_DependencyModel)\lib\netstandard2.0\Microsoft.Extensions.DependencyModel.dll" DestinationFolder="$(PowerShellModuleArtifactsPath)" />

0 commit comments

Comments
 (0)