devdeer.tools.tocpm 1.0.0-beta

This is a prerelease version of devdeer.tools.tocpm.
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.0.0-beta                
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.0.0-beta                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=devdeer.tools.tocpm&version=1.0.0-beta&prerelease                
nuke :add-package devdeer.tools.tocpm --version 1.0.0-beta                

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 --prerelease 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
0.0.1-alpha

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 net7.0 is compatible.  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.3.0 148 8/5/2024
1.2.0 486 3/30/2024
1.1.1 703 12/6/2023
1.1.0 484 12/6/2023
1.0.1 826 3/25/2023
1.0.0-beta 755 1/10/2023
0.0.3-alpha 670 12/27/2022
0.0.2-alpha 690 12/27/2022
0.0.1-alpha 725 12/27/2022

- Fixed Regex for package references causing a bug where items where not found if no blank character was before the final slash.