Skip to content
TalonZeng

How I Use AI on a Mac to Develop Fully Offline Windows Host Software

My working setup: the Mac goes online over Wi-Fi, and Codex / Claude Code run on the Mac. Windows holds the project, talks to devices, and runs the builds, with no Internet egress, talking to the Mac only over a LAN. This tutorial explains the design and includes deployment prompts I can give directly to an AI.

zhudi33 min read
Share
Overall architecture: the Mac is online; Windows uses only the development LAN

My working setup: the Mac goes online over Wi-Fi, and Codex / Claude Code run on the Mac. Windows holds the project, talks to devices, and runs the builds. Windows has no Internet egress; it only communicates with the Mac on a LAN.

This tutorial helps me take a collaboration method I already use and bring it to another Windows machine. It explains the design and also provides deployment prompts I can give directly to an AI.

1. Why I set it up this way#

My program is C# host software (上位机). It may use WPF, WinForms, .NET 8/9/10, or classic .NET Framework. Serial ports, CAN, PLCs, cameras, acquisition cards, and vendor drivers usually live on Windows.

On the other hand, I am used to Codex and Claude Code on a Mac. I want to keep the Mac's Internet access, and I do not want to install an AI client, sign in to an account, or configure a model API key on Windows.

So I split the work into three parts: the Mac handles AI and editing, Windows handles builds and devices, and a LAN connects the two.

When I say "the model runs on the Mac," that is everyday language. More precisely, the AI client and agent process run on the Mac; when a cloud service is used, model inference usually still happens on the provider's servers. An offline Windows machine does not mean the code will not be sent to the cloud through the Mac. If a project forbids sending code outside, I must switch to an approved internal or local model. I cannot use this connection method to bypass confidentiality requirements.

2. How the two machines divide the work#

Task

Where I do it

What connects them

Sign in to Codex / Claude Code and call the model

Mac

The Mac's Wi-Fi

Read and edit C#, XAML, and other source files

AI tools on the Mac; the files actually live on Windows

SMB file sharing

Restore dependencies, compile, and run unit tests

Local Windows disks and processes

SSH commands initiated from the Mac

Look at WPF windows, debug with breakpoints, and verify devices

A Windows desktop session

An approved tool such as Moonlight, or operate the machine locally

Obtain offline installers and dependency packages

The Mac, or an approved online Windows preparation environment

Download, then carry them over the LAN or a USB drive

I do not install another copy of Codex or Claude on Windows. The Windows SSH service accepts ordinary commands, and SMB provides ordinary file access; neither needs a model account.

My preferred approach is "edit directly over SMB + build locally over SSH." There is only one copy of the repository, which avoids code sync and merge conflicts. After the Mac finishes editing, Windows sees the same files. The compiler uses the project path on the Windows machine's local SSD, not a network drive.

3. Benefits and the costs I am willing to accept#

What I get

The corresponding cost

AI accounts and clients stay only on the Mac

The Mac must be able to reach the model service

Windows keeps having no Internet egress

SDKs, NuGet packages, and driver updates need offline materials prepared in advance

Windows uses real drivers and hardware

GUI and device verification cannot rely on a successful build alone

The same approach can work with different AI tools

Each tool still needs permission for local files and SSH tools

There is only one copy of the source to maintain

Searching a large repo over SMB will be slower than on a local SSD

Build logs come straight back to the AI

An SSH session is not the same as a desktop logon session

I do not treat "the SSH command runs" as the whole job being done. When the host software talks to devices, I also confirm bitness, drivers, configuration, permissions, and the desktop running state.

4. Step 1: Get the network right, without changing the isolation requirements#

A concrete example that is easy to follow:

  • The Mac's Wi-Fi: goes online normally according to the site environment.
  • The Mac's wired NIC or USB NIC: 192.168.50.1/24.
  • The Windows development NIC: 192.168.50.2/24.
  • This Windows development connection is not given a default gateway or DNS.
  • The two machines are connected directly, or through a dedicated switch with no Internet egress.

These are example addresses only. Before deploying, I first check Wi-Fi, VPN, plant/device subnets, and existing routes, and pick a non-overlapping subnet. I cannot simply reuse the old machine's 192.168.1.253, and I cannot change a NIC configuration that a PLC is already using just to make development easier. When a device network is present, I prefer a separate development NIC.

I turn off Internet Sharing on the Mac, and I do not configure a bridge, NAT, a proxy, or an SSH tunnel to give Windows Internet access. Leaving out a gateway is only one of the conditions. I also check Windows' other NICs, IPv6 default routes, VPNs, the system proxy, and forwarding settings on the Mac. The fact that a particular website fails to load is not proof that isolation is already in place.

On the Mac I can check ports:

bash
nc -vz -G 3 192.168.50.2 22
nc -vz -G 3 192.168.50.2 445

22 is SSH and 445 is SMB. Failures are normal if the services have not been deployed yet. A failed ping does not necessarily mean the path is down; ICMP may be blocked by the firewall.

On Windows I inventory interfaces and routes:

plaintext
Get-NetIPConfiguration
Get-NetRoute -DestinationPrefix '0.0.0.0/0'
Get-NetRoute -DestinationPrefix '::/0'
netsh winhttp show proxy

These read-only outputs help me locate problems. The final judgment still depends on the physical cabling and the network policy.

5. Step 2: Inventory the project first, and prepare offline materials that actually work#

I have the AI read the solution, project files, global.json, Directory.Build.*, Directory.Packages.props, NuGet.Config, lock files, and the notes for installers and vendor SDKs.

Project situation

What Windows may need

SDK-style .NET 8/9/10

The Windows .NET SDK required by the project, plus matching runtimes and reference packs

WPF / WinForms

Windows Desktop components and the target Windows SDK (as the project requires)

Classic .NET Framework

An appropriate version of VS Build Tools / Visual Studio, and the target Framework Developer/Targeting Pack

C++/CLI, COM, installers

The matching VS workloads, Windows SDK, registered components, WiX, and so on

Serial ports, CAN, PLCs, cameras

Vendor drivers, SDKs, license files, and x86/x64 matching conditions

Having a runtime is not the same as being able to compile; having a newer SDK is also not the same as being able to compile every older project. I choose versions according to global.json, the target frameworks, and the SDK selection rules, and I install side by side when needed, rather than blindly installing the latest one. For the difference between SDKs and runtimes, see the Microsoft .NET Windows installation documentation.

I download official offline installers on the Mac that match the Windows architecture, and I record the source, version, and SHA-256. On Windows I verify the hash and the digital signature. Do not use an ARM64 installer from an Apple Silicon Mac on an x64 Windows machine by mistake.

A special note: the few-megabyte Visual Studio bootstrapper is not a complete offline installer. A full VS / Build Tools layout usually has to be prepared on a compatible online Windows environment and then carried over; you can also use installation media the organization has already prepared. A Mac can store and transfer these files, but it cannot natively run the Windows layout generator. The process is described in Microsoft's offline installation guide.

If I only have a Mac, the target Windows machine cannot go online at all, and the project lacks complete VS materials, I list that explicitly as something still to be prepared. In that situation I cannot claim that "one command has already set up the entire environment."

6. Step 3: Open SMB and SSH with a dedicated account#

I start by creating an ordinary local account#

Previously I signed in with a Windows Hello PIN, and I got a 8646 error when I tried to change the associated account password with net user. That error does not prove that no password was ever set successfully, but it does show that that particular change did not complete. A PIN also cannot be used as a general-purpose SMB / SSH password.

My approach is to create a dedicated ordinary local account, for example macdev, set the password through a secure prompt, and never send the password into a chat or write it into a script. Creating the account and configuring the system for the first time requires a local administrator; the everyday development account does not need to be added to the Administrators group for that reason.

Below is an administrator PowerShell example for the AI to adapt. It creates the account only if it does not already exist:

plaintext
$password = Read-Host '为专用开发账户输入密码' -AsSecureString
New-LocalUser -Name 'macdev' -Password $password -Description 'Mac LAN development'
$usersGroup = Get-LocalGroup -SID 'S-1-5-32-545'
Add-LocalGroupMember -Group $usersGroup -Member 'macdev'
Remove-Variable password

If an account with the same name already exists, I first check what it is used for, and I do not reset its password. Passwords and private keys are not deliverables of this tutorial.

I share only the project directory#

I have the AI set a share name, for example WinDev, pointing at D:\Projects\MyApp. Permissions come in two layers: SMB share permissions and NTFS file permissions. Both must allow the development account to read and write.

I grant "Modify" on the project directory, and I avoid sharing an entire drive, giving Everyone Full Control, or turning off the firewall. An administrator example:

plaintext
$project = 'D:\Projects\MyApp'
$account = "$env:COMPUTERNAME\macdev"
if (-not (Test-Path -LiteralPath $project -PathType Container)) {
    throw '项目目录不存在,先核对真实路径'
}
# 已有共享须先审计,不能直接重复创建。
icacls $project /grant "${account}:(OI)(CI)M"
New-SmbShare -Name 'WinDev' -Path $project -ChangeAccess $account

This sets inheritable permissions on the root of the directory. It does not guarantee a fix for subdirectories that have already had inheritance disabled. If a write fails, I inspect the ACL of the specific file; I should not reset permissions on the entire repository.

In Mac Finder I press Command-K and connect to:

plaintext
smb://192.168.50.2/WinDev

I sign in as WINDOWS-HOSTNAME\macdev and let the system store the credentials securely. After mounting, I confirm the actual path, which is commonly /Volumes/WinDev; I do not assume it will have that name every time.

I install the SSH service and configure keys#

If Windows already has OpenSSH Server, I check the service status. If it does not, I download compatible official installation materials on the Mac and carry them to Windows for an offline install. I do not repeatedly run install commands that depend on Windows Update on an offline machine, and I do not mix SSH packages from multiple sources without checking.

The Win32-OpenSSH MSI path is described in the official installation guide. At deployment time I re-select a suitable version and architecture and verify the source. I do not take a pre-release version used on an old machine as the default for every new machine.

After installation, an administrator confirms:

plaintext
Get-Service sshd
Set-Service sshd -StartupType Automatic
Start-Service sshd

Windows inbound rules allow only the Mac's development NIC IP to reach TCP 22 and 445. After creating narrow rules, I also check whether broader older rules still exist; adding a restrictive rule does not automatically cancel another wide allow rule. When adjusting rules, I keep a local or existing remote-desktop recovery path.

On the Mac I use a separate SSH alias and key for each host, for example:

bash
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_win_lab -C mac-to-win-lab

I set a passphrase on the private key interactively, and I use the local ssh-agent / Keychain to support automation. The private key stays on the Mac; only the .pub public key is copied.

For an ordinary Windows user, the public-key file should live under .ssh\authorized_keys in that account's actual user profile. I first sign in as that account and confirm $env:USERPROFILE. I do not guess by concatenating paths; a previous machine had an actual directory such as C:\Users\macdev.zhuzhu. Accounts in the Administrators group have different default public-key file rules, which is another reason I prefer an ordinary account. Permissions and locations follow Microsoft's Windows SSH key documentation.

An SSH config example on the Mac:

plaintext
Host win-lab
    HostName 192.168.50.2
    User macdev
    IdentityFile ~/.ssh/id_ed25519_win_lab
    IdentitiesOnly yes
    PreferredAuthentications publickey
    PasswordAuthentication no

On the first connection, I verify the host key fingerprint against what Windows displays locally, and only then accept and record it. If the host key changes when I move to a new machine, I verify it; I do not simply turn off host-key checking.

Acceptance commands:

bash
ssh -o BatchMode=yes win-lab whoami
ssh win-lab 'powershell.exe -NoProfile -Command "dotnet --list-sdks"'

The PasswordAuthentication no here is only a Mac client setting. It is not proof that the server has already disabled password authentication. If I want to disable it on the server, I must first verify key-based login, back up the configuration, check the configuration syntax, and connect again after the change.

7. Step 4: Solve offline NuGet, instead of letting Windows quietly go online#

SDKs, NuGet packages, the Windows SDK, VS workloads, and vendor drivers are different materials. Copying a .nuget directory by itself does not solve every problem.

I prefer to start from a preparation environment that has already built the same project, at the same commit, with the same target framework, architecture, and restore parameters, and export a complete set of dependency materials. I can collect the original .nupkg files from its NuGet cache, turn them into a local feed, and record versions and hashes. Another method is to download missing packages on the Mac by exact package ID and version, and fill the gaps by repeating offline restores.

A successful restore on the Mac does not mean Windows already has a complete set of dependencies. Conditional references, runtime identifiers such as win-x64, desktop reference packs, native libraries, WiX, and MSBuild SDKs can all differ. Only a real offline restore and build on the target Windows machine counts as acceptance.

I keep the package feed outside the project, for example at D:\OfflineDev\NuGetFeed, and I copy and adapt this package's templates/NuGet.Offline.Config. That configuration uses <clear /> to drop inherited ordinary remote package sources and keeps only the local directory. If a team project depends on packageSourceMapping, a private feed, or package trust settings, I audit and merge first; I do not overwrite them mechanically.

An SDK-style project example:

plaintext
dotnet restore 'D:\Projects\MyApp\MyApp.sln' --configfile 'D:\OfflineDev\NuGet.Offline.Config' --packages 'D:\OfflineDev\NuGetCache'
dotnet build 'D:\Projects\MyApp\MyApp.sln' --no-restore -c Debug
dotnet test 'D:\Projects\MyApp\MyApp.sln' --no-build --no-restore -c Debug

I give the feed and the cache appropriate read/write permissions. On the offline machine I restore again as the actual build account, so that obj asset files are generated for this machine, instead of reusing absolute paths from an old account. Every time the account, target, or restore parameters change, I check again.

The local feed mechanism is described in Microsoft NuGet Local feeds. If I use nuget.exe to create a feed, I can run nuget init in the Windows preparation environment. Packages downloaded natively on the Mac can also be placed first in a flat local package directory and reorganized later according to the size of the project.

I do not treat --ignore-failed-sources as an offline configuration; it does not prevent access to remote sources. I also do not treat --no-restore as a switch that means "never go online": custom MSBuild tasks, download scripts, audit sources, and HTTP requests in tests all have to be checked. Physical isolation and routing policy are what finally enforce the network boundary.

For classic packages.config projects, I have the AI separately determine a nuget.exe restore or a suitable MSBuild restore flow, and then compile with the full VS MSBuild. I cannot force every legacy project into dotnet build. The older MSBuild in Windows' built-in Framework directories also cannot be treated as a general substitute for modern VS Build Tools.

8. Step 5: Hand "edit → build → feedback" to the AI#

In the AI tool on the Mac I open the project directory that I have already confirmed is mounted, and then I tell it the Windows path and the SSH alias. I run the CLI in a local terminal on the Mac, not by running the AI in a remote Windows terminal.

At the start of each session, I first have it confirm that the mount point and the remote files correspond. After an SMB drop, I must not keep editing in a same-named empty folder and assume the changes landed on Windows.

This package provides templates/remote-ci.ps1, which is suitable for common SDK-style .NET solutions. Place it in the project's scripts folder and point it at the actual relative path of the solution; by default it only allows restores from a local package source. Mixed legacy projects, special platforms, signing, publish, or installer flows need to be adapted first. The template does not claim universal compatibility.

An example of calling it from the Mac:

bash
ssh win-lab 'powershell.exe -NoProfile -ExecutionPolicy Bypass -File D:\Projects\MyApp\scripts\remote-ci.ps1 -Task Restore -Solution MyApp.sln -NuGetConfig D:\OfflineDev\NuGet.Offline.Config'
ssh win-lab 'powershell.exe -NoProfile -ExecutionPolicy Bypass -File D:\Projects\MyApp\scripts\remote-ci.ps1 -Task Build -Solution MyApp.sln'
ssh win-lab 'powershell.exe -NoProfile -ExecutionPolicy Bypass -File D:\Projects\MyApp\scripts\remote-ci.ps1 -Task Test -Solution MyApp.sln'

The example paths have no spaces. When a real path contains spaces, I use correct Windows argument quoting or a verified wrapper. I do not rely on stacking layers of quotes and hoping. The default Windows SSH shell may be cmd.exe, so I cannot feed it PowerShell semicolons, variables, or single-quote syntax directly; starting powershell.exe -NoProfile explicitly reduces those differences. If the organization has execution-policy requirements, I sign or unblock the script according to those rules; I do not globally loosen the policy just because of an example.

I put project rules in AGENTS.md / CLAUDE.md, and I require the AI to:

  • Edit on the Mac, and compile and test on Windows.
  • Skip irrelevant scans of bin, obj, and .vs; never hand-edit generated artifacts or files inside .git.
  • Preserve existing uncommitted changes and the line-ending policy.
  • Explicitly report the total number of tests, failures, filter conditions, and anything that was not verified.
  • Before adding a new dependency, explain how the offline materials will be updated in sync.

For how project instructions are used, see OpenAI's AGENTS.md documentation and Claude Code's project memory documentation. Rules are guidance for the agent; they are not an access grant, and they are not an operating-system security policy. They cannot replace file permissions, network isolation, or actual tests.

9. Step 6: Verify windows, debugging, and devices separately#

Starting a program over SSH does not guarantee that a window will appear on the Windows desktop I am looking at. The GUI, clipboard, current-user encryption, certificates, COM, device permissions, and user profile can all be affected by the session.

So I split verification into three layers:

  1. Build acceptance: the target solution and the Debug/Release and x86/x64 configurations are correct; I record the logs and artifact paths.
  2. Test acceptance: business logic, protocol parsing, and ViewModel tests have been run, and I record the results item by item.
  3. Desktop and device acceptance: I open the program on the current user's Windows desktop and verify layout, bindings, the actual connection, and typical operations.

When I already have Moonlight, I continue using the LAN desktop connection that is already configured. A new computer also needs the matching Windows-side service and authorization; installing the Mac client alone is not enough. I can also use Remote Desktop according to the Windows version and site rules, or operate the Windows screen directly. Hardware stays plugged into Windows.

When the host software drives real actuators, the first joint test uses a simulator or a clearly defined safe condition. Asking the AI to fix communication code is not authorization for it to automatically drive a real motor or send PLC control commands.

10. What I can reuse from the old machine#

We previously completed an actual deployment of E:\Project\EnglishDailyUseAPPWindow. According to the session record:

  • SMB file access and SSH key-based login already passed.
  • Windows used SDK 10.0.302. After an online restore of that project, the Debug build had 0 warnings and 0 errors.
  • During a full test run, 318 tests passed, and 1 DPAPI test returned "Access Denied."
  • After that case was explicitly filtered out, 318 tests passed.

This proves that the remote edit, build, and test path for the old project worked. It does not prove that a fully offline migration has already passed. The restore at that time used the Internet. The new machine must have offline materials prepared and must be accepted again.

In addition, a healthy DPAPI folder permission is not enough to assert that the root cause must be a non-interactive SSH token, still less to guarantee that every desktop scenario will work. The right approach is to test, separately, a desktop logon with the same account, different SSH authentication methods, user-profile loading, and a minimal DPAPI call, confirm the difference, and only then decide how to fix it. I must not delete tests, skip them by default, or weaken product encryption just to get an all-green run.

The old project once had a large number of line-ending differences. During migration, I have the AI save the Git state first and inspect why the diffs exist; I do not batch-normalize line endings. For Git scans over SMB, if they are slow, I prefer to have Windows' local Git run over SSH.

11. How I start fastest on another Windows machine#

I first fill in New machine information and acceptance.md, then open Codex / Claude Code in a tool that can actually run on the Mac, and paste the "first-deployment master prompt" from Prompts.md.

The order is:

  1. Read-only inventory of the network, accounts, directories, project, and toolchain.
  2. Confirm missing materials and obtain them from the Mac or a preparation environment.
  3. A local administrator completes the account, share, SSH, and firewall configuration.
  4. The Mac verifies SMB writes and SSH key-based login.
  5. Windows performs a real offline restore, build, and test.
  6. The Windows desktop accepts the GUI and devices.
  7. Save redacted configuration, an operation record, rollback steps, and unfinished items.

If the AI currently has no Windows administrative channel, it cannot invent the first channel out of thin air. It can first generate a reviewed bootstrap script, which I then run once from the Windows machine itself, an existing remote desktop, or a USB drive; later work can be automated over SSH.

If the new machine's project is very large and SMB scanning clearly slows things down, I then consider "a local working copy on the Mac + constrained one-way incremental sync." Before introducing a second copy of the code, I first define the direction of changes, conflict detection, deletion handling, and exclusion rules for build directories. This tutorial first makes the single-copy source workflow solid.

12. What standard I use to judge that the setup succeeded#

I do not look only at a "connected successfully" message. I at least want this evidence:

  • Windows has not obtained Internet egress through the Mac or any other interface.
  • The model client is usable on the Mac, and Windows has not had a model agent installed or signed in for this approach.
  • After a temporary file is written from the Mac, Windows reads back the same content, and then only that temporary file is cleaned up.
  • SSH can run commands as the expected account, using a key.
  • Dependencies are restored only from an approved local source, and missing packages are listed honestly.
  • A real build of the original project finishes and returns an accurate exit code.
  • Full tests and filtered tests are clearly distinguished; if the GUI or devices were not verified, that is marked as unverified.
  • After a disconnect and reconnect, the mount can be restored; after the SSH service restarts, it is usable. A full machine reboot is scheduled separately and does not interfere with devices on site.
  • Rollback only undoes configuration created in this pass; it does not delete account data, existing shares, or the entire firewall rule set by mistake.

What I ultimately take away is not a set of hard-to-remember commands, but the tutorial, a parameter sheet, an offline materials list, reusable prompts, and a real acceptance record. When I move to another Windows machine, the AI inventories and verifies again within these boundaries, and I can reuse the same development habits.


Appendix A: Prompts I can copy and paste#

Before use: first fill in "New machine information and acceptance.md" in the same directory, and give it together with this tutorial to an AI that runs on the Mac and has file and command execution. An ordinary chat window without tool access can only give steps; it cannot actually deploy.

The square brackets below are parameters to fill in. If I do not know a value, I write "to be discovered" rather than inventing one. The prompts do not contain passwords, private keys, or API keys.

1. First-deployment master prompt#

plaintext
Please actually deploy a joint Mac and offline Windows C# host-software development environment, and produce an acceptance record.

My boundaries:
- Codex / Claude Code clients, agent processes, and model accounts stay only on the Mac.
- The Mac goes online over Wi-Fi.
- Windows has no Internet egress, and may communicate with the Mac only over an approved LAN.
- Do not turn on Internet Sharing on the Mac, and do not create NAT, a bridge, a proxy, a VPN, or an SSH tunnel to give Windows Internet access.
- The project may be processed by cloud AI on the Mac within an approved scope; credentials, production data, and files that must not leave the premises must not enter the model context.
- Windows holds the only working copy. The Mac edits over SMB, and Windows runs local builds over SSH.
- Do not install, sign in to, or start any AI agent on Windows.

My parameters:
Mac development NIC IP: [fill in or to be discovered]
Windows IP / hostname: [fill in or to be discovered]
Windows version and architecture: [fill in or to be discovered]
Project root: [for example D:\Projects\MyApp]
Solution relative path: [for example MyApp.sln]
Dedicated ordinary local user: [for example macdev]
Share name: [for example WinDevLab]
SSH alias: [for example win-lab; do not overwrite my existing win-dev]
Existing administrative channel: [local / Moonlight / Remote Desktop / none]
Offline materials directory: [for example D:\OfflineDev]
Vendor SDKs, device connections, and whether joint testing is allowed: [fill in]
Available online Windows preparation environment or installation media: [fill in or none]

Please execute in this order:
1. First do a read-only inventory of network interfaces, routes, proxies, the project, Git status, users, shares, SSH, SDKs, MSBuild, the Windows SDK, and NuGet configuration.
2. Inspect global.json, target frameworks, architecture, conditional dependencies, packages.config, lock files, private package sources, and vendor SDKs; list the offline materials that must be prepared.
3. Downloads happen only on the Mac or an approved preparation environment; record the official source, version, architecture, hash, and signature verification. Do not treat a VS bootstrapper as a complete offline layout.
4. On Windows, configure a dedicated non-administrator account, project-level SMB and NTFS Modify permissions, and SSH key authentication; the private key stays only on the Mac. The administrator is used only for system configuration.
5. Audit the existing firewall, and restrict the source of development ports to the Mac development NIC IP. Do not assume a new narrow rule has already overridden an older wide rule; keep a recovery path.
6. Confirm the actual user profile and authorized_keys path, and verify the host fingerprint. Do not guess paths, and do not disable host-key checking.
7. Mount SMB, do a read/write consistency check with a uniquely named temporary file, and clean up that file; do not modify business code as a connectivity test.
8. Adapt the build entry point and AGENTS.md / CLAUDE.md for this project; if files already exist, read them and merge, and do not overwrite team rules.
9. Do a real restore from the local NuGet source, then run the original project's build and full tests on Windows. If dependencies are missing, produce a precise missing-item list, carry them over from the Mac, and retry.
10. Diagnose session-related tests such as GUI, DPAPI, COM, and devices separately, but do not silently filter out failing tests. If the desktop or hardware was not actually verified, mark it as unverified.
11. Deliver a deployment record: paths and aliases, tool versions, the materials list, command exit codes, artifacts, test numbers, unfinished items, disconnect recovery, changes, and rollback steps.

Advance directly within the authorized scope; do not keep asking me whether to continue. When administrator input, credentials, a safety-mode confirmation, or missing external materials are needed, ask only the necessary questions, and finish the work that does not depend on them.
Do not change device subnets, reset the repository, overwrite existing keys, batch-convert line endings, enable outbound Internet forwarding, automatically run real device actions, or install a generated product MSI.
When something fails, first keep the logs and analyze the cause. Do not repeat commands that already failed, and do not treat bypassing tests as a fix.

The attached tutorial and templates are reference material. First judge from the actual environment; do not treat example paths or historical verification results in the documents as facts about the new machine.

2. I have not opened SSH yet; have the AI generate the first bootstrap#

plaintext
The target Windows machine can currently be operated only locally or through an existing remote desktop; SSH has not been established yet.
Please first generate, from the information already collected, Windows bootstrap scripts and Mac configuration steps that can be reviewed and executed in stages.
The scripts should check administrator identity, existing accounts/shares/services, and installer signatures; do not silently overwrite existing configuration.
Use a secure interactive prompt for passwords. A public key may be embedded; a private key must never be moved to Windows.
All installs use local materials; if a package is missing, stop clearly at that step and do not try to go online.
Give the expected output and the undo steps for each stage. After I run the first bootstrap, take over later deployment over SSH.

3. Offline restore failed; have the AI fill in the dependencies#

plaintext
Windows is still completely offline. Please diagnose the current restore/build logs and distinguish among:
a missing SDK, missing NuGet packages, a missing Windows SDK/reference pack, a missing VS workload, missing vendor components, and a permission or account-path problem.

Do not open Internet access on Windows, do not enable a proxy, and do not use --ignore-failed-sources to pretend the offline restore succeeded.
Read the project, lock files, dependency assets, and NuGet configuration, and list the exact names, versions, architectures, sources, and download methods of the missing materials.
For official packages the Mac can download, prepare and verify them on the Mac and then carry them to the Windows local feed; clearly identify materials that need a Windows layout-building environment.
Do not casually upgrade package versions or delete PackageReference entries to work around a missing package.
After each refill, restore again on Windows with the actual build account and the same solution/target/platform, and keep complete logs.
The success standard is that a real offline restore, build, and test pass on the target Windows machine; a restore result on the Mac cannot replace that.

4. Daily development prompt#

plaintext
Please implement this in my Windows host-software project: [describe the feature, acceptance criteria, and behavior that must not change].

SSH alias for this session: [fill in]; Windows project path: [fill in];
Mac SMB mount directory: [fill in]; build entry point: [fill in].
First verify that the mount and the Windows path really correspond, then read AGENTS.md / CLAUDE.md and the relevant code and Git status.

The AI runs on the Mac. Source files are modified over SMB. Builds and tests must run on Windows locally.
Windows is offline; any new dependency must be handled together with an offline-materials plan.
Make only the changes this requirement needs, and preserve existing uncommitted work and the line-ending policy.
Build after small batches of changes, run related tests according to risk, and finally run the agreed acceptance commands.
Do not start a GUI in an ordinary SSH session and then claim the UI has been verified; list the steps that need Windows desktop acceptance.
Do not send real device control commands without explicit authorization.
Deliver the changed files, functional changes, build and test results, artifact paths, and remaining limits, and do not commit or push on your own.

5. Diagnosing an SSH build or test failure#

plaintext
Please diagnose the current remote build/test failure, and first keep the original errors and exit codes.
Check the actual user, USERPROFILE, working directory, SDK/MSBuild versions, NuGet cache paths and permissions, and the platform configuration.
If DPAPI, certificates, COM, the GUI, drivers, or devices are involved, use a minimal reproduction to compare the SSH session with a desktop session of the same account.
Write "confirmed facts," "hypotheses still to be verified," and "suggested fixes" separately.
Do not assert a root cause from a single Access Denied; do not weaken encryption, delete tests, or set a default filter just to make tests pass.
If a filtered test run is used for diagnosis, clearly report what was excluded, and keep the full-suite failure status.

6. Acceptance and handoff after moving to a new machine#

plaintext
Please accept this deployment item by item according to "New machine information and acceptance.md."
Do not reuse the old machine's IP, account, host fingerprint, or passing test conclusions.
Verify the network boundary, SMB read/write, SSH keys, local dependency restore, a real build, full tests, and reconnect recovery.
For GUI/hardware that needs on-site operation, give me the fewest clear steps, and fill in the results from actual feedback.
Check that no passwords, private keys, API keys, or large installers were left in the source repository.
Output a redacted deployment record and rollback steps that only undo the changes made this time. For each item, fill in pass/fail/unverified and the evidence; do not replace a result with "it should work."

Appendix B: Parameter and acceptance sheet I take to a new Windows machine#

This sheet is a blank template; do not automatically treat "to be filled in" as a pass.

Basic information#

Field

Actual value

Date / purpose of the machine

To be filled in

Mac Wi-Fi subnet / development NIC IP

To be filled in

Windows hostname / IP / architecture / version

To be filled in

Windows device NIC and networks that must not be changed

To be filled in

Project root / solution

To be filled in

Target framework / SDK / platform configuration

To be filled in

Dedicated ordinary account / actual USERPROFILE

To be filled in

SMB share name / actual Mac mount point

To be filled in

SSH alias / public-key fingerprint / server host fingerprint

To be filled in

Local NuGet feed / cache / config file

To be filled in

VS / MSBuild / Windows SDK / driver versions

To be filled in

Remote-desktop method / recovery path

To be filled in

Approved scope for sending code to the cloud

To be filled in

Approved scope for device joint testing

To be filled in

Do not record passwords, private keys, API keys, or production credentials.

Offline materials list#

Material

Version and architecture

Official source

SHA-256 / signature

Windows storage location

OpenSSH (if missing)

To be filled in

To be filled in

To be filled in

To be filled in

.NET SDK / desktop runtime

To be filled in

To be filled in

To be filled in

To be filled in

VS / Build Tools layout

As needed

To be filled in

To be filled in

To be filled in

Framework targeting pack

As needed

To be filled in

To be filled in

To be filled in

NuGet / MSBuild SDK / WiX

Per project

To be filled in

To be filled in

To be filled in

Vendor SDK / drivers / licenses

Per project

To be filled in

To be filled in

To be filled in

Acceptance record#

Check

Pass / fail / unverified

Evidence, commands, log locations

No Internet egress, no Mac sharing/forwarding, interfaces/routes audited

Unverified

To be filled in

AI clients and accounts only on the Mac

Unverified

To be filled in

SSH/SMB firewall scope and older wide rules checked

Unverified

To be filled in

SMB temporary file content matches on both ends and was cleaned up

Unverified

To be filled in

SSH key login and the actual account are correct

Unverified

To be filled in

Offline restore from the local source only succeeded

Unverified

To be filled in

Debug / target-platform build

Unverified

To be filled in

Release / packaging (if required)

Unverified

To be filled in

Full tests: total, passed, failed, skipped

Unverified

To be filled in

Filtered tests: filter expression and excluded cases

Unverified

To be filled in

Windows desktop GUI verification

Unverified

To be filled in

Device / driver / communication verification

Unverified

To be filled in

Reconnect and mount recovery

Unverified

To be filled in

Service startup configuration / a scheduled reboot check

Unverified

To be filled in

Existing Git changes preserved; no credentials entered the source

Unverified

To be filled in

Changes in this pass and rollback#

Item by item, fill in the newly created account, share name, firewall rule identifiers, service source, configuration backup locations, and the Mac SSH configuration and key paths. Rollback should undo only what was added this time.

Before deleting a dedicated account, first handle files and DPAPI-encrypted data it owns; do not simply delete the account and the user directory. Do not delete the entire firewall configuration or overwrite an existing SSH configuration. Leave installers in the materials directory; clean up temporary test files only by their exact paths.

Not yet finished#

Record blocking conditions, missing materials/permissions, the next verification command, and the owner. Items that were not executed stay "Unverified."


Appendix C: Scope of the templates#

These files are a starting point to adapt when deploying to a new machine. They were not executed on a new Windows machine when this tutorial was written.

  • AGENTS.md / CLAUDE.md: first fill in the real paths, and merge existing rules.
  • NuGet.Offline.Config: change it to this machine's offline feed and cache paths; audit existing package-source mapping, signature verification, and private-package configuration.
  • remote-ci.ps1: place it in the project's scripts directory. It is suitable for common SDK-style solutions; it does not install software automatically, and it does not adapt every .NET Framework, C++/CLI, special-platform, or publish command. A modified script needs to be verified on the target Windows machine.

The script's Build does not automatically Restore; Test does not automatically Build. Run Restore → Build → Test, and use the same configuration. The restore stage requires an existing local-disk package source; it does not accept a network URL or a UNC source. If a LAN package source is needed, the person doing the deployment must adapt it explicitly.

The offline restore command explicitly turns off NuGet's online audit for that invocation. Dependency vulnerability checks should be done in an approved online preparation environment. This configuration only constrains ordinary package sources; it cannot stop a project's custom tasks from going online on their own. Windows network isolation still has to be guaranteed by the actual network configuration.

The script does not bake in any test exclusions. TestFilter is only for an explicit diagnostic task, and the output will note the filter; a filtered pass cannot replace full-test acceptance.


Appendix D: Original template files#

templates/AGENTS.md#

markdown
# Mac AI / offline Windows development

此文件是模板。部署时替换以下字段,并与仓库已有规则合并:
- Windows root: <WINDOWS_PROJECT_ROOT>
- macOS SMB mount: <MAC_MOUNT>
- SSH host alias: <SSH_ALIAS>
- Solution / platform: <SOLUTION_AND_PLATFORM>
- Approved build entry point: <BUILD_ENTRY>

Rules:
- AI clients and credentials stay on macOS. Windows has no Internet access.
- Never enable Internet sharing, forwarding, proxying or tunnels to give Windows Internet access.
- Confirm the SMB mount and Windows path correspond before editing. Preserve unrelated changes and existing line endings.
- Edit source via SMB. Build/test on Windows local storage via SSH and explicit PowerShell -NoProfile.
- Read relevant files only. Avoid scanning bin, obj, .vs and generated content. Do not manually edit generated files or Git internals.
- Prefer Windows-side Git inspection for large repositories. Do not commit, push or reset without task authorization.
- Restore only from approved local package sources. New dependencies need an offline material plan.
- Record exact exit codes and full-test results. Any filtered run must state its filter and exclusions.
- SSH is not a GUI session. Do not claim GUI, DPAPI or hardware verification without evidence.
- Do not run real actuator/PLC/motion commands without explicit task authorization.
- Never write passwords, private keys or model credentials into source, scripts, logs or chat.
- This file guides the agent; it does not grant permissions or enforce network isolation.

templates/CLAUDE.md#

markdown
# Mac AI / offline Windows development

Before working, read the project AGENTS.md and apply its verified machine paths and build commands.
Claude Code runs on macOS. Windows is the offline source/build/device host.
This file is a template: merge it with existing project instructions rather than overwriting them.

templates/NuGet.Offline.Config#

xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!-- Adapt paths, ACLs and any existing packageSourceMapping before use. -->
  <packageSources>
    <clear />
    <add key="OfflineFeed" value="D:\OfflineDev\NuGetFeed" />
  </packageSources>
  <config>
    <add key="globalPackagesFolder" value="D:\OfflineDev\NuGetCache" />
  </config>
</configuration>

templates/remote-ci.ps1#

plaintext
# Template for SDK-style .NET solutions only.
# Place in PROJECT_ROOT/scripts; adapt for mixed legacy projects and special platforms.
[CmdletBinding()]
param(
    [Parameter(Mandatory = $true)]
    [string]$Solution,
    [ValidateSet('Info', 'Restore', 'Build', 'Test')]
    [string]$Task = 'Build',
    [ValidateSet('Debug', 'Release')]
    [string]$Configuration = 'Debug',
    [string]$NuGetConfig,
    [string]$TestFilter
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$solutionPath = Join-Path $root $Solution

function Invoke-Checked {
    param([string]$Program, [string[]]$Arguments)
    & $Program @Arguments
    $code = $LASTEXITCODE
    if ($code -ne 0) {
        Write-Host "Command failed with exit code $code"
        exit $code
    }
}

try {
    if (-not (Test-Path -LiteralPath $solutionPath -PathType Leaf)) {
        throw "Solution not found: $solutionPath"
    }
    Set-Location -LiteralPath $root
    $env:DOTNET_CLI_TELEMETRY_OPTOUT = '1'
    $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = '1'
    if ($Task -eq 'Info') {
        Write-Host "Root: $root"
        Write-Host "User: $env:USERNAME; Profile: $env:USERPROFILE"
        Invoke-Checked 'dotnet' @('--list-sdks')
        Invoke-Checked 'dotnet' @('--list-runtimes')
    } elseif ($Task -eq 'Restore') {
        if (-not $NuGetConfig -or -not (Test-Path -LiteralPath $NuGetConfig -PathType Leaf)) {
            throw 'Restore requires an explicit existing offline NuGet config.'
        }
        [xml]$configXml = Get-Content -LiteralPath $NuGetConfig -Raw
        $sourceNodes = @($configXml.SelectNodes('/configuration/packageSources/add'))
        if (-not $configXml.SelectSingleNode('/configuration/packageSources/clear')) {
            throw 'Offline config must clear inherited package sources.'
        }
        if ($sourceNodes.Count -eq 0) { throw 'No local package source configured.' }
        foreach ($node in $sourceNodes) {
            $source = [Environment]::ExpandEnvironmentVariables($node.GetAttribute('value'))
            # Intentionally require absolute local-drive feeds in this starter template.
            if ($source -notmatch '^[A-Za-z]:[\\/]' -or -not (Test-Path -LiteralPath $source -PathType Container)) {
                throw "Feed must be an existing absolute Windows local directory: $source"
            }
        }
        # Disables NuGet advisory fetching for this offline invocation only.
        # Dependency security review should happen separately in the approved preparation environment.
        Invoke-Checked 'dotnet' @('restore', $solutionPath, '--configfile', $NuGetConfig, '-p:NuGetAudit=false', '--nologo')
    } elseif ($Task -eq 'Build') {
        Invoke-Checked 'dotnet' @('build', $solutionPath, '-c', $Configuration, '--no-restore', '--nologo')
    } else {
        $testArgs = @('test', $solutionPath, '-c', $Configuration, '--no-build', '--no-restore', '--nologo')
        if ($TestFilter) {
            Write-Warning "FILTERED TEST RUN. This is not full-suite acceptance. Filter: $TestFilter"
            $testArgs += @('--filter', $TestFilter)
        }
        Invoke-Checked 'dotnet' $testArgs
    }
    exit 0
} catch {
    Write-Error $_
    exit 1
}

Comments

No comments yet — be the first to leave one.

Related articles