Added samples to the API - #40930
Added samples to the API#40930
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a set of standalone samples under doc/samples/ demonstrating how to use the WSL Container API (Microsoft.WSL.Containers) from C, C++/WinRT, and C#—intended to be referenced from WSL documentation.
Changes:
- Adds three runnable “pull/run” samples: C (HelloWorld), C++/WinRT (Neofetch), and C# (Nextcloud).
- Adds a C# sample that demonstrates building and running a custom container image via the SDK’s
<WslcImage>MSBuild integration. - Adds a samples index README plus a samples-local
.gitignoreto support keeping these hand-authored project files in-repo.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| doc/samples/WSLC-NextCloud/WSLCNextCloud.csproj | New .NET 8 console project referencing Microsoft.WSL.Containers. |
| doc/samples/WSLC-NextCloud/README.md | Build/run/storage instructions for the Nextcloud sample. |
| doc/samples/WSLC-NextCloud/Program.cs | C# sample that pulls nextcloud and runs it with port + volume mapping. |
| doc/samples/WSLC-Neofetch/WSLCNeofetch.vcxproj.filters | VS filters file for the Neofetch sample project. |
| doc/samples/WSLC-Neofetch/WSLCNeofetch.vcxproj | C++/WinRT sample project wiring NuGet packages + build settings. |
| doc/samples/WSLC-Neofetch/WSLCNeofetch.sln | VS solution for building the Neofetch sample. |
| doc/samples/WSLC-Neofetch/README.md | Build/run instructions for the Neofetch sample. |
| doc/samples/WSLC-Neofetch/packages.config | NuGet dependencies for the C++/WinRT Neofetch sample. |
| doc/samples/WSLC-Neofetch/neofetch.cpp | C++/WinRT sample that runs neofetch in a container and streams output. |
| doc/samples/WSLC-HelloWorld/WSLCHelloWorld.vcxproj | C sample project wiring the WSLC SDK package. |
| doc/samples/WSLC-HelloWorld/WSLCHelloWorld.sln | VS solution for building the HelloWorld C sample. |
| doc/samples/WSLC-HelloWorld/README.md | Build/run instructions for the HelloWorld sample. |
| doc/samples/WSLC-HelloWorld/packages.config | NuGet dependency for the HelloWorld sample. |
| doc/samples/WSLC-HelloWorld/helloworld.c | Minimal C sample using the flat wslcsdk.h API to run echo. |
| doc/samples/WSLC-CustomContainer/WSLCCustomContainer.csproj | C# project that auto-builds a custom image via <WslcImage>. |
| doc/samples/WSLC-CustomContainer/README.md | Explains the <WslcImage> auto-build flow and how to run the sample. |
| doc/samples/WSLC-CustomContainer/Program.cs | C# sample that loads a locally-built image tar and runs a Python tool inside. |
| doc/samples/WSLC-CustomContainer/Container/qr.py | Python tool that prints an ASCII/Unicode QR code in the container. |
| doc/samples/WSLC-CustomContainer/Container/Containerfile | Containerfile that installs qrcode and copies qr.py. |
| doc/samples/README.md | Top-level index describing all four samples. |
| doc/samples/.gitignore | Samples-local ignore rules + re-includes for project files normally ignored at repo root. |
Blue (OneBlue)
left a comment
There was a problem hiding this comment.
Change looks good overall, couple minor comments
I also recommend add a pipeline to validate that all of these actually build (we can use a GH pipeline to make this easy, and only trigger it when doc/samples is edited
…icrosoft/wsl into user/crloewen/wslc-api-samples
|
Fixed up requests - should be good to merge now I think! |
Blue (OneBlue)
left a comment
There was a problem hiding this comment.
LGTM. I think it would be a good idea to have a github action pipeline to build the sample, just to make sure that they don't get broken in future changes, but this can be done in a future change
Added 4 basic samples for the WSLC API that will be referenced in the WSL docs.