This file contains repo-specific guidance for any AI agent (Copilot, Claude, Cursor, etc.) working in this repository.
MsRdpEx (“Microsoft RDP Extensions”) is a Windows-focused project that:
- Builds a native hooking DLL:
MsRdpEx.dll(Detours-based) - Builds launcher EXEs:
mstscex.exe,msrdcex.exe,vmconnectex.exe - Includes an optional .NET package:
Devolutions.MsRdpEx(NuGet) - Includes an MSI installer built with WiX v4
Key folders:
dll/: native DLL implementationexe/: native launcher EXEschannels/: DVC-related code (e.g.,DvcServer)dotnet/: C# projects + NuGet packaginginstaller/: WiX v4 project + sourcesdependencies/detours/: prebuilt Detours package used by CMakescripts/: PowerShell build helpers (notably Detours regeneration)
- Prefer small, targeted changes. Avoid mass reformatting or mechanical renames.
- Don’t change packaging/versioning unless the task explicitly asks for it.
- Treat any credential-like strings as secrets:
- Do not add logging that could capture passwords/tokens.
- The
.RDPoptionsClearTextPassword/GatewayPasswordare “testing only”; avoid persisting them.
- Avoid editing
.github/workflows/*unless explicitly requested (they’re owned by DevOps). - Keep Windows compatibility in mind (this is not a cross-platform repo).
Typical local prerequisites:
- Windows 10/11
- Visual Studio 2022 (MSVC v143) or newer with “Desktop development with C++”
- CMake (Visual Studio generator)
- PowerShell 7 (
pwsh) for scripts - For managed builds: .NET SDK 8.x (and .NET Framework targeting packs if building
net48)
CMake expects a prebuilt Detours package in dependencies/detours/.
Example x64 build:
cmake -G "Visual Studio 17 2022" -A x64 -DWITH_DOTNET=OFF -B build-x64
cmake --build build-x64 --config ReleaseOutputs are placed under the build directory (e.g. build-x64/Release/).
Architectures:
-A Win32(x86)-A x64-A ARM64
This repo commits a prebuilt Detours layout under dependencies/detours/ and ignores other dependencies/* content.
dependencies/*is ignored by.gitignoredependencies/detours/is explicitly not ignored (it’s meant to be present)dependencies/sources/is ignored (Detours source clone lives here)
If Detours is missing or needs updating, regenerate it from the repo root:
pwsh -ExecutionPolicy Bypass -File .\scripts\detours-all.ps1Notes:
scripts/detours.ps1expects a Visual Studio developer environment (viaVSCMD_ARG_TGT_ARCH).scripts/detours-all.ps1can optionally installVsDevShellfor the current user (-InstallVsDevShell).
The .NET build is wired through CMake as external MSBuild projects.
Managed-only CMake build (used by CI):
cmake -G "Visual Studio 17 2022" -A x64 -DWITH_DOTNET=ON -DWITH_NATIVE=OFF -B build-dotnet
cmake --build build-dotnet --config Release
dotnet pack .\dotnet\Devolutions.MsRdpEx -o packagePackaging note:
- The NuGet package includes native
MsRdpEx.dllforwin-x86,win-x64,win-arm64fromdependencies/MsRdpEx/<arch>/MsRdpEx.dll. - If you’re producing a NuGet package locally, ensure those native binaries are present (CI populates them by building native per-arch first).
The MSI build consumes the native binaries from dependencies/MsRdpEx/<arch>/ and is driven by installer/MsRdpEx.sln.
CI-style build (per arch):
# x64 example
$platform = 'x64' # Win32, x64, ARM64
dotnet build /p:Configuration=Release /p:Platform=$platform installer/MsRdpEx.slnThe workflow also rewrites installer/Variables.wxi to set ProductVersion (MSI short version) during packaging. Avoid manual edits unless asked.
- The canonical version is
dotnet/Devolutions.MsRdpEx/Devolutions.MsRdpEx.csproj<Version>. - The top-level
CMakeLists.txtparses that<Version>to defineMSRDPEX_VERSION. - CI may rewrite
<Version>during release packaging.
Guideline for agents: don’t bump <Version> unless the task explicitly requests it.
The com/ folder contains generated artifacts related to mstscax.dll / rdclientax.dll interop.
- Follow
com/README.mdif you need to regenerate.tlh/.tli,mstscax.idl, or C# interop assemblies. - Prefer not to hand-edit generated outputs unless regeneration is part of the task.
Extended logging is controlled via environment variables (examples):
$Env:MSRDPEX_LOG_ENABLED="1"
$Env:MSRDPEX_LOG_LEVEL="DEBUG" # TRACE is extremely verboseDefault log location is under %LocalAppData%\MsRdpEx\MsRdpEx.log unless overridden.
When a task touches build logic, try to validate locally:
- Native:
cmake --build <builddir> --config Release - Managed:
dotnet pack .\dotnet\Devolutions.MsRdpEx -o package
If you can’t run a full build (missing toolchain), keep the changes minimal and explain what should be validated by a human (arch matrix, MSI packaging, etc.).