Skip to content

Instantly share code, notes, and snippets.

View windows-dev-setup.md

Windows Dev Setup

Basics

  • .NET SDK
  • Visual Studio Code
    • Exensions: WSL, C#, Docker, Yaml, Dapr, Bracket Pair Colorizer 2, Git History, Git Lens, Markdown (All-inOne, Shortcuts, Preview Enhanced)
    • Preferences: Restore Windows (None)
  • Git for Windows
    • Select VS Code as default editor
  • Enable Curl: add to user PATH env var "C:\Program Files\Git\mingw64\bin"
View install-localstack.md

Using LocalStack

Prerequisites

Using Docker to Run LocalStack

docker run --rm -p 4566:4566 -p 4571:4571 localstack/localstack
View WinDesktop.Dockerfile
# escape=`
# Installer image
FROM mcr.microsoft.com/windows/servercore:1909 AS installer
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Retrieve .NET Core Runtime
# USER ContainerAdministrator
RUN $dotnet_version = '3.1.5'; `
View WinNano.Dockerfile
FROM mcr.microsoft.com/dotnet/core/runtime:3.1-nanoserver-1909 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1909 AS build
WORKDIR /src
COPY ["MyWpfConsoleApp.csproj", "./"]
RUN dotnet restore "./MyWpfConsoleApp.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "MyWpfConsoleApp.csproj" -c Release -o /app/build
View WinDesktop.Dockerfile
# escape=`
# Installer image
FROM mcr.microsoft.com/windows/servercore:1909 AS installer
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Retrieve .NET Core Runtime
# USER ContainerAdministrator
RUN $dotnet_version = '3.1.5'; `
View wpf-console-program.cs
using System;
using System.Windows.Media.Media3D;
namespace MyWpfConsoleApp
{
public static class Program
{
public static void Main()
{
var point = new Point3D(1, 2, 3);
View MyWpfConsoleApp.csproj
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<OutputType>Exe</OutputType>
</PropertyGroup>
</Project>
View console-producer
docker exec -it broker bash
cd /usr/bin
./kafka-console-producer --broker-list broker:29092 --topic "raw-events"
View console-consumer
docker exec -it broker bash
cd /usr/bin
./kafka-console-consumer --bootstrap-server broker:29092 --topic "processed-events"
View kafka-docker-compose
git clone https://github.com/confluentinc/cp-all-in-one
cd cp-all-in-one
git checkout 5.5.0-post
cd cp-all-in-one/
docker-compose up -d --build
docker-compose ps