devdeer.tools.tocpm 1.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global devdeer.tools.tocpm --version 1.1.1                
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 devdeer.tools.tocpm --version 1.1.1                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=devdeer.tools.tocpm&version=1.1.1                
nuke :add-package devdeer.tools.tocpm --version 1.1.1                

dotnet-tocpm

Dotnet global tool to convert solutions to the Nuget CPM.

Summary

Switching to Nuget CPM can be a pain when it comes to bigger solutions containing a number of projects. dotnet-tocpm was created to perform this operation in one simple step.

Requirements

The tool requires the .NET 7 runtime (or SDK) installed on the machine.

Installation

Use the following command to install dotnet-tocpm:

dotnet tool install -g devdeer.tools.tocpm

After this command ran you can check the success by running:

tocpm -v

This should result in an output like this:

tocpm -v
1.0.1

Usage

If you run the command without any params it will display the help information:

tocpm
USAGE:
    tocpm [OPTIONS] <COMMAND>

EXAMPLES:
    tocpm simulate .
    tocpm run C:\temp\project
    tocpm run C:\temp\project -f

OPTIONS:
    -h, --help       Prints help information
    -v, --version    Prints version information

COMMANDS:
    simulate    Simulates the operation at the provided location and writes the results to the console
    execute     Executes a real run at the specified location

A simple and secure way to test the tool is to perform a dry run. Use the simulate command for this by specifying a folder. Lets assume that you've got a solution in the folder C:\temp\test. Your command then would be

tocpm simulate C:\temp\test

The output would look something like this:

Running...
Found 17 files.
Found 31 unique packages.
┌───────────────────────────────────────────────────────────────────┬─────────┐
│ Package ID                                                        │ Version │
├───────────────────────────────────────────────────────────────────┼─────────┤
│ AspNetCore.HealthChecks.AzureStorage                              │ 6.1.2   │
│ NUnit3TestAdapter                                                 │ 4.3.1   │
│ StackExchange.Redis                                               │ 2.6.86  │
│ Swashbuckle.AspNetCore                                            │ 6.4.0   │
│ Swashbuckle.AspNetCore.Annotations                                │ 6.4.0   │
└───────────────────────────────────────────────────────────────────┴─────────┘
The following content would be written to D:\repos\Heurich\Laker\Directory.Packages.props if executed with command
execute:
<Project>
  <PropertyGroup>
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
  </PropertyGroup>
  <ItemGroup>
    <PackageVersion Include="AspNetCore.HealthChecks.AzureStorage" Version="6.1.2" />
    <PackageVersion Include="NUnit3TestAdapter" Version="4.3.1" />
    <PackageVersion Include="StackExchange.Redis" Version="2.6.86" />
    <PackageVersion Include="Swashbuckle.AspNetCore" Version="6.4.0" />
    <PackageVersion Include="Swashbuckle.AspNetCore.Annotations" Version="6.4.0" />
  </ItemGroup>
</Project>

To actually perform the operation you first replace simulate by execute. This also gives you 2 more options (run tocpm execute -h):

  • -f|--force will prevent any confirmation from the user before executing the command.
  • -b|--backup will create a copy of each project file in its folder with the file ending .bak.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.3.0 161 8/5/2024
1.2.0 490 3/30/2024
1.1.1 708 12/6/2023
1.1.0 489 12/6/2023
1.0.1 832 3/25/2023
1.0.0-beta 761 1/10/2023
0.0.3-alpha 674 12/27/2022
0.0.2-alpha 694 12/27/2022
0.0.1-alpha 729 12/27/2022

- Complete redesign of version identification to fix bugs with packages with more than 1 line and additional attributes lost in packages.
           - Upgraded to .NET 8.
           - Package upgrades of Spectre Console.