CsWin32
Copilot instructions2.5k starsChanged 7 months agoMITView on GitHub
Trending
Quiet this year.about the whole repository
Who's talking about microsoft/CsWin32
- dotnet/pinvoke“New Source Generator based approach to getting all the Win32 methods and types you need”GitHub · Jan 21, 2021 · 50 reactions
- NuGet/Home“Support for source generators that add non BCL code”GitHub · Apr 9, 2021 · 11 reactions
- dotnet/winforms“Move most of OLE code to CsWin32”GitHub · Jan 6, 2023 · 5 reactions
- A Hacker News story“C#/Win32 P/Invoke Source Generator”Hacker News · May 14, 2025 · 4 points
- dotnet/winforms“Start using CsWin32”GitHub · Jul 19, 2022 · 4 reactions
The biggest 5 of 22 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 22
Talked about on GitHub and Hacker News (22 times).
On GitHub · 21
- Jan 21, 2021New Source Generator based approach to getting all the Win32 methods and types you need — dotnet/pinvoke50 reactions · 22 comments
- Apr 9, 2021Support for source generators that add non BCL code — NuGet/Home11 reactions · 18 comments
- Jan 6, 2023Move most of OLE code to CsWin32 — dotnet/winforms5 reactions · 4 comments
- Jul 19, 2022Start using CsWin32 — dotnet/winforms4 reactions · 21 comments
- Jan 4, 2024Switch away from using PresentationBuildTasks and Microsoft.WinFx.targets from C:\Windows — dotnet/wpf3 reactions · 6 comments
16 more on GitHub
- May 25, 2021Compiler can't load an analyzer where a binding redirect may be needed — dotnet/roslyn3 reactions · 4 comments
- Mar 24, 2025Maybe build upon cs-win32 approach to generate wrappers — waitingsong/node-win32-api2 reactions
- Sep 13, 2023Use generated PInvokes and exchange types — dotnet/aspnetcore2 reactions · 19 comments
- Aug 18, 2021Make more structs AnyCPU-compatible by assuming Pack=4 for x86 — microsoft/win32metadata2 reactions · 2 comments
- Jun 16, 2021NormalizeWhitespace() extension method is *dog slow*, causing bad experience with Source Generators — dotnet/roslyn2 reactions · 3 comments
- Nov 20, 2025Switch to source generated COM — citelao/AccView1 reaction
- Nov 14, 2025'&method group' does not work with implicit operators of the exact unmanaged delegate type — dotnet/roslyn1 reaction · 6 comments
- Oct 28, 2025WPF app using CsWin32 fails to publish - GenerateTemporaryTargetAssembly project is not importing nuget props — dotnet/sdk1 reaction · 4 comments
- Jul 9, 2025Consider using CsWin32 — opentk/opentk1 reaction
- Apr 22, 2025[Bug] Fix `IImageList::GetIcon()` call when https://github.com/microsoft/CsWin32/issues/1402 is resolved. — PSAppDeployToolkit/PSAppDeployToolkit1 reaction · 1 comment
- Jan 12, 2024Metadata falsely represents native classes as typedef structs — microsoft/win32metadata1 reaction · 4 comments
- Aug 24, 2022Settings API simplification — microsoft/PowerToys1 reaction · 3 comments
- Mar 30, 2022IIncrementalGenerator support — unoplatform/uno1 reaction · 18 comments
- Feb 26, 2022OmniSharp does not recognize classes, members, and props generated by CsWin32 — dotnet/vscode-csharp1 reaction · 3 comments
- Jul 21, 2021Warning for partial ComImport types with members in more than one type part — dotnet/runtime1 reaction · 9 comments
- Dec 2, 2020VS error list often populates with warnings despite suppression by .editorconfig — dotnet/roslyn1 reaction · 22 comments
On Hacker News · 1
- May 14, 2025C#/Win32 P/Invoke Source Generator4 points
The file
We split this copilot-instructions.md into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
Avoid introducing binary breaking changes in public APIs of projects under src unless their project files have IsPackable set to false.
- Distinctive: line 23
Add API doc comments to all new public and internal members.
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Copilot instructions for this repository
High level guidance
- Review the
CONTRIBUTING.mdfile for instructions to build and test the software. - Set the
NBGV_GitEngineenvironment variable toDisabledbefore running anydotnetormsbuildcommands.
Software Design
- Design APIs to be highly testable, and all functionality should be tested.
- Avoid introducing binary breaking changes in public APIs of projects under
srcunless their project files haveIsPackableset tofalse.
Testing
- There should generally be one test project (under the
testdirectory) per shipping project (under thesrcdirectory). Test projects are named after the project being tested with a.Testsuffix. - Tests should use the Xunit testing framework.
- Some tests are known to be unstable or require special hardware. When running tests locally, you can skip hardware-dependent tests by running
dotnet test --filter "TestCategory!=RequiresHardware". To also skip high-memory tests (which each consume ~4GB), add&TestCategory!=HighMemoryto the filter.
Coding style
- Honor StyleCop rules and fix any reported build warnings after getting tests to pass.
- In C# files, use namespace statements instead of namespace blocks for all new files.
- Add API doc comments to all new public and internal members.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

