offlineprep - Offline Preparation
Overview
The offlineprep command prepares your development environment for offline work by updating git repositories and caching NuGet packages. This is essential for developers who need to work without internet connectivity, such as during travel, in secure environments, or in areas with unreliable internet.
Syntax
nmbl offlineprep <RootPath> [options]Arguments
RootPath- Root directory containing git repositories and projects
Options
--skip-git- Skip git repository updates--skip-nuget- Skip NuGet package caching--cache-path <path>- Custom path for NuGet cache (default: ~/.nuget/offline-cache)
What It Does
The command performs these steps:
- Git Updates - Updates all git repositories to latest
- NuGet Caching - Downloads and caches all NuGet packages locally
- Validation - Verifies all dependencies are available offline
Examples
Prepare Workspace for Offline Work
nmbl offlineprep ~/projectsUpdates all repositories and caches all NuGet dependencies.
Before Travel
# Day before flight
nmbl offlineprep ~/workspaceEnsure you can work during travel without internet.
Skip Git Updates
nmbl offlineprep ~/projects --skip-gitOnly cache NuGet packages, don’t update repositories.
Custom Cache Location
nmbl offlineprep ~/projects --cache-path /external-drive/nuget-cacheUse a specific location for the NuGet cache (useful for external drives).
Use Cases
Travel Preparation
# Before a long flight or trip
nmbl offlineprep ~/workspace
# Verify everything is cached
dotnet restore --source ~/.nuget/offline-cacheSecure/Air-Gapped Environments
# On internet-connected machine
nmbl offlineprep ~/projects --cache-path /usb/nuget-cache
# Transfer USB to air-gapped machine
# Configure NuGet to use the cacheUnreliable Internet
# During stable connection
nmbl offlineprep ~/workspace
# Work offline when connection is poorWeekly Sync
# Every Monday morning
nmbl offlineprep ~/workspaceKeep everything up to date regularly.
Conference/Training Prep
# Before attending conference
nmbl offlineprep ~/demo-projects
# Present demos without worrying about WiFiHow NuGet Caching Works
The command:
- Scans all projects for package references
- Downloads missing packages to local cache
- Configures NuGet to use the local source
- Validates packages are available
Using the Offline Cache
After running offlineprep, NuGet is configured to use the local cache:
# Restore from cache
dotnet restore
# The cache is automatically used as a sourceVerification
Check Git Status
# After offlineprep
nmbl gitstatus ~/projectsVerify all repositories are up to date.
Verify NuGet Cache
# List cached packages
ls -la ~/.nuget/offline-cache
# Test restore
dotnet restore --source ~/.nuget/offline-cacheTest Offline Build
# Disconnect internet
# Try building
dotnet build
# Should succeed using cached dependenciesDisk Space Considerations
The NuGet cache can be large:
- Caches all versions of all packages
- Consider using external storage for large workspaces
- Regularly clean old packages
Estimate Cache Size
# Before caching
du -sh ~/.nuget/offline-cache
# After caching
du -sh ~/.nuget/offline-cacheClean Old Cache
# Remove old cache before creating new one
rm -rf ~/.nuget/offline-cache
nmbl offlineprep ~/projectsAdvanced Usage
Multi-Stage Preparation
# Stage 1: Update git repos
nmbl offlineprep ~/projects --skip-nuget
# Stage 2: Cache NuGet (after reviewing updates)
nmbl offlineprep ~/projects --skip-gitCustom Workflow
#!/bin/bash
# prepare-offline.sh
echo "Preparing for offline work..."
# Update repositories
echo "Updating git repositories..."
nmbl gitupdate ~/projects
# Cache NuGet packages
echo "Caching NuGet packages..."
nmbl offlineprep ~/projects --skip-git
# Verify
echo "Verifying setup..."
nmbl gitstatus ~/projects
dotnet restore --source ~/.nuget/offline-cache
echo "Ready for offline work!"Team Shared Cache
# Create shared cache for team
nmbl offlineprep ~/team-projects --cache-path /shared/nuget-cache
# Team members configure NuGet to use shared cache
dotnet nuget add source /shared/nuget-cache --name TeamCacheTroubleshooting
Git Update Fails
If git updates fail:
# Check status first
nmbl gitstatus ~/projects
# Resolve conflicts manually
# Then cache NuGet packages
nmbl offlineprep ~/projects --skip-gitNuGet Cache Incomplete
If some packages aren’t cached:
# Re-run with verbose output
nmbl offlineprep ~/projects --verbose
# Check for errorsDisk Space Issues
If running out of space:
# Use external drive
nmbl offlineprep ~/projects --cache-path /external/cache
# Or clean old cache first
rm -rf ~/.nuget/offline-cache
nmbl offlineprep ~/projectsBest Practices
Regular Updates
# Weekly sync when online
nmbl offlineprep ~/workspaceBefore Offline Periods
# Before extended offline work
nmbl offlineprep ~/workspaceVerify Before Disconnecting
# Test offline build
nmbl offlineprep ~/projects
# Disconnect internet
dotnet build
dotnet testDocument for Team
# Before Traveling
Run: `nmbl offlineprep ~/projects`
Verify: `dotnet build`