pack-csharp 0.2.0

dotnet add package pack-csharp --version 0.2.0
NuGet\Install-Package pack-csharp -Version 0.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="pack-csharp" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add pack-csharp --version 0.2.0
#r "nuget: pack-csharp, 0.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install pack-csharp as a Cake Addin
#addin nuget:?package=pack-csharp&version=0.2.0

// Install pack-csharp as a Cake Tool
#tool nuget:?package=pack-csharp&version=0.2.0

Whats going on

I borrowed the ideas of a process runner from the dotnet watch command and simplified a bit. I also embedded a specific version of the pack cli within the package (which is why it's ~40mb) for linux, macos, and windows. During construction the correct binary is reconstructed locally for the given OS. Then when either the pack, inspect, or version method is run a process spec is built and run in the background using a runner. The output is fed back as a collection of lines for logging.

Get started

Add the nuget distributed package to your project.

dotnet add package pack-csharp

Initialize the constructor

using pack-csharp

var logger = new LoggerFactory().CreateLogger<Pack>();
const bool quiet = false;
const bool verbose = true;
const bool timeStamps = true;

var pack = new Pack(logger, quiet, verbose, timeStamps);

Create an artifact to be containerized

dotnet publish my-project -o "c:\pub"

# optionally you could zip it up and provide the full path to zip
# Compress-Archive -Path "c:\pub" -DestinationPath "c:\artifact.zip"

(make sure docker is running)

Build the container image

var cts = new CancellationTokenSource();
var output = await pack.Build("some-repo/my-image", "paketobuildpacks/builder:base", "c:\pub", cts.Token);
logger.LogInformation(string.Join(Environment.NewLine, output));

Inspect the resulting image

var inspection = await pack.Inspect("some-repo/my-image");
logger.LogInformation(inspection));

Options

When running pack.Build you can optionally provide a PackBuildSpec. This offers all kinds of options to manipulate and configure the image and build environment.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.0 492 8/27/2021
0.1.0 562 7/31/2021