Migrating Legacy Apps Using KanastaCorp .NET Tools: Best Practices

Getting Started with KanastaCorp .NET Tools: A Beginner’s Guide

This guide walks you through installing, configuring, and using KanastaCorp .NET Tools to streamline development tasks. It assumes basic familiarity with .NET, Visual Studio or VS Code, and the command line.

1. What the tools include

  • CLI utilities: project scaffolding, build wrappers, and deployment helpers.
  • NuGet packages: libraries for logging, configuration, and common helpers.
  • VS/VS Code extensions: templates, code snippets, and debugging aids.
  • CI/CD integrations: tasks for popular pipelines (GitHub Actions, Azure Pipelines).

2. Prerequisites

  • .NET SDK 6.0 or later (install latest LTS unless you need a specific version).
  • Visual Studio 2022+ or Visual Studio Code with C# extension.
  • Git (for cloning sample repos and templates).
  • Optional: Docker if you plan to containerize apps.

3. Installation

  1. Install the .NET SDK from Microsoft’s download page.
  2. Install the KanastaCorp CLI (example):

    Code

    dotnet tool install -g kanastacorp.tools
  3. Add NuGet packages to a project:

    Code

    dotnet add package KanastaCorp.Logging dotnet add package KanastaCorp.Configuration
  4. (Optional) Install the editor extension from the marketplace or VSIX.

4. Creating a new project

  1. Scaffold a project using the CLI:

    Code

    kanasta new webapp –name MyApp
  2. Open the generated solution:
    • Visual Studio: double-click the .sln file.
    • VS Code: code MyApp.

5. Key configuration files

  • appsettings.json — defaults for logging, connection strings, and feature flags.
  • kanasta.config.json — tool-specific settings (template choices, telemetry opt-out).
  • Dockerfile / docker-compose.yml — container setup if scaffolded.

6. Common tasks and commands

  • Build and run:

    Code

    dotnet build dotnet run –project src/MyApp
  • Run tool checks:

    Code

    kanasta diagnose
  • Apply code formatting and analyzers:

    Code

    kanasta format –apply kanasta analyze
  • Create a production-ready build:

    Code

    dotnet publish -c Release -o ./publish

7. Using the logging and configuration packages

  • Register services in Program.cs / Startup.cs:

    csharp

    builder.Services.AddKanastaLogging(builder.Configuration.GetSection(“KanastaLogging”)); builder.Services.AddKanastaConfiguration();
  • Read settings with strong types:

    csharp

    var options = builder.Configuration.GetSection(“MyFeature”).Get<MyFeatureOptions>();

8. Debugging and troubleshooting

  • Use kanasta diagnose to surface common configuration issues.
  • Enable verbose logging during development: set log level to Debug in appsettings.Development.json.
  • For extension issues, check the extension output channel in your editor.

9. CI/CD basics

  • Example GitHub Actions step to build and publish:

    yaml

    - name: Setup .NET uses: actions/setup-dotnet@v3 with:

    dotnet-version: '7.0.x' 
    • name: Restore and build run: dotnet build –configuration Release
    • name: Publish run: dotnet publish -c Release -o ./publish
  • Use the provided KanastaCorp pipeline tasks for automated test reporting and deployment steps.

10. Best practices

  • Keep the Kan

Comments

Leave a Reply