Intent.RoslynWeaverSanitizer.CLI 1.0.0-pre.0

This is a prerelease version of Intent.RoslynWeaverSanitizer.CLI.
dotnet tool install --global Intent.RoslynWeaverSanitizer.CLI --version 1.0.0-pre.0
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local Intent.RoslynWeaverSanitizer.CLI --version 1.0.0-pre.0
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Intent.RoslynWeaverSanitizer.CLI&version=1.0.0-pre.0&prerelease
nuke :add-package Intent.RoslynWeaverSanitizer.CLI --version 1.0.0-pre.0

RoslynWeaver Sanitizer

The RoslynWeaver Sanitizer CLI tool can be used to remove all references of Intent code management attributes and NuGet packages from a Visual Studio solution.

Removing code management attributes and NuGet references may be needed for situations where a deployment policy prevents inclusion of unapproved/non-essential NuGet packages.

[!NOTE] Intent code management attributes are passive and contain no processing logic, additionally, because all the attributes have [Conditional("INTENT_ROSLYN_WEAVER_ATTRIBUTES")] applied to them, the C# compiler code does not include them in the generated CIL. The source code for the Intent.RoslynWeaver.Attributes NuGet package is available on GitHub for review.

Pre-requisites

Latest Long Term Support (LTS) version of .NET.

Installation

The tool is available as a .NET Tool and can be installed with the following command:

dotnet tool install Intent.RoslynWeaverSanitizer.CLI --global

[!NOTE] If dotnet tool install fails with an error to the effect of The required NuGet feed can't be accessed, perhaps because of an Internet connection problem. and it shows a private NuGet feed URL, you can try add the --ignore-failed-sources command line option (source).

You should see output to the effect of:

You can invoke the tool using the following command: intent-csharp-code-management-sanitizer
Tool 'intent.roslynweaversanitizer.cli' (version 'x.x.x') was successfully installed.

Usage

intent-csharp-code-management-sanitizer <sln-path> [options]

Arguments

Argument Description
<sln-path> The path of the .sln file of the solution to sanitize.

Options

Option Description
--version Show version information
-?, -h, --help Show help and usage information

Example: Azure Pipelines

Create a step to install the tool

- task: PowerShell@2
  displayName: 'Install the Intent RoslynWeaver Sanitizer'
  inputs:
    targetType: 'inline'
    pwsh: true
    script: 'dotnet tool install Intent.RoslynWeaverSanitizer.CLI --global'

Create a step to run the tool

- task: PowerShell@2
  displayName: 'Run the Intent RoslynWeaver Sanitizer'
  inputs:
    targetType: 'inline'
    pwsh: true
    script: 'intent-csharp-code-management-sanitizer src/Solution.sln'

[!IMPORTANT] The above two tasks must happen in your pipeline before the task which compiles the Visual Studio solution.

A complete YAML file

trigger:
  batch: 'true'
  branches:
    include:
    - '*'

pool:
  vmImage: 'ubuntu-latest'

steps:

- task: PowerShell@2
  displayName: 'Install the Intent RoslynWeaver Sanitizer'
  inputs:
    targetType: 'inline'
    pwsh: true
    script: 'dotnet tool install Intent.RoslynWeaverSanitizer.CLI --global'

- task: PowerShell@2
  displayName: 'Run the Intent RoslynWeaver Sanitizer'
  inputs:
    targetType: 'inline'
    pwsh: true
    script: 'intent-csharp-code-management-sanitizer src/Solution.sln'

- task: DotNetCoreCLI@2
  displayName: 'dotnet publish'
  inputs:
    command: 'publish'

Run the pipeline

When you run the pipeline, it will install the tool, run it and then compile the solution without any Intent dependencies.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
1.0.0-pre.0 82 6/7/2023
1.0.0-alpha.2 77 6/7/2023
1.0.0-alpha.1 80 6/7/2023