Simply double-click Build-Installer.bat or run from command line:
Build-Installer.batThis will:
- ? Verify prerequisites (.NET SDK, WiX Toolset)
- ? Build the Memory Monitor application
- ? Create the MSI installer
- ? Display the installer location
Build-Installer.batBuilds the application and creates the installer.
Build-Installer.bat cleanRemoves all previous build output.
Build-Installer.bat rebuildCleans then builds everything from scratch.
Build-Installer.bat testBuilds the installer and offers to install it immediately for testing.
The batch file will automatically check for:
- Required: Yes
- Auto-install: No
- Download: https://dotnet.microsoft.com/download/dotnet/8.0
- Required: Yes
- Auto-install: Yes (if missing)
- Manual install:
dotnet tool install --global wix
- Checked: Memory Monitor.csproj
- Checked: MemoryMonitorSetup.wixproj
- Checked: Package.wxs
============================================================================
BUILD COMPLETE
============================================================================
[SUCCESS] Installer created successfully!
Location: C:\...\MemoryMonitorSetup\bin\Release\en-US\MemoryMonitorSetup.msi
Size: 2 MB
Created: 12/15/2024 10:30 AM
============================================================================
To install:
msiexec /i "MemoryMonitorSetup.msi"
To install with logging:
msiexec /i "MemoryMonitorSetup.msi" /l*v install.log
To uninstall:
msiexec /x "MemoryMonitorSetup.msi"
============================================================================
BUILD FAILED
============================================================================
Please check the error messages above and try again.
For help, see:
- MemoryMonitorSetup\INSTALLER_FIX_README.md
- MemoryMonitorSetup\QUICK_REFERENCE.md
Memory Monitor\bin\Release\net8.0-windows\
??? Memory Monitor.exe (Main application)
??? Memory Monitor.dll (Application library)
??? Memory Monitor.deps.json (Dependencies)
??? Memory Monitor.runtimeconfig.json
??? System.CodeDom.dll (Dependency)
??? System.Management.dll (Dependency)
MemoryMonitorSetup\bin\Release\en-US\
??? MemoryMonitorSetup.msi (Windows Installer package)
The installer will place files at:
C:\Program Files\Memory Monitor\
Memory Monitor.exe
Memory Monitor.dll
Memory Monitor.deps.json
Memory Monitor.runtimeconfig.json
System.CodeDom.dll
System.Management.dll
Start Menu\Programs\Memory Monitor\
Memory Monitor (shortcut)
HKCU\Software\MemoryMonitor
installed = 1
[ERROR] .NET SDK not found!
Solution: Install .NET 8 SDK from https://dotnet.microsoft.com/download
[WARNING] WiX Toolset not found!
Installing WiX Toolset...
Solution: The script will auto-install. If it fails, manually run:
dotnet tool install --global wix[ERROR] Project file not found
Solution:
- Run the batch file from the solution root directory
- Verify the project structure matches the expected layout
[ERROR] Application build failed!
Solution:
- Open the solution in Visual Studio
- Check for compilation errors
- Fix errors and try again
- Or build from Visual Studio directly first
[ERROR] Installer build failed!
Solution:
- Check that all files in Package.wxs exist in bin folder
- Verify Package.wxs has no syntax errors
- Look for specific error messages in output
- Check that all GUIDs in Package.wxs are unique
[WARNING] MSI file not found at expected location
Solution:
- Check alternate locations in
MemoryMonitorSetup\bin\ - Review build output for actual output path
- Verify WiX build completed without errors
- Checks for .NET SDK
- Checks for WiX Toolset
- Verifies project files exist
- Auto-installs WiX if missing
dotnet build "Memory Monitor\Memory Monitor.csproj" -c Release- Compiles C# code
- Resolves dependencies
- Creates executable and DLLs
- Output:
Memory Monitor\bin\Release\net8.0-windows\
- Checks main executable exists
- Lists all files to be included
- Verifies required dependencies present
dotnet build "MemoryMonitorSetup\MemoryMonitorSetup.wixproj" -c Release- Processes Package.wxs
- Creates MSI database
- Embeds application files
- Output:
MemoryMonitorSetup\bin\Release\en-US\MemoryMonitorSetup.msi
- Shows installer location
- Displays file size and timestamp
- Provides installation commands
- Offers test installation (if test mode)
The original PowerShell script is still available:
.\MemoryMonitorSetup\Build-Installer.ps1If the batch file doesn't work, build manually:
REM 1. Build application
cd "Memory Monitor"
dotnet build -c Release
REM 2. Build installer
cd ..\MemoryMonitorSetup
dotnet build -c Release
REM 3. Find MSI
dir /s /b *.msiFor CI/CD pipelines:
Build-Installer.bat rebuild
if errorlevel 1 exit /b 1
copy "MemoryMonitorSetup\bin\Release\en-US\*.msi" "%ARTIFACT_DIR%"Build-Installer.bat testThen respond "Y" when prompted.
msiexec /i "MemoryMonitorSetup.msi" /l*v install.log- Look for Start Menu shortcut: "Memory Monitor"
- Check Program Files:
C:\Program Files\Memory Monitor\ - Verify application runs: Click Start Menu shortcut
msiexec /x "MemoryMonitorSetup.msi" /l*v uninstall.log- Check Program Files folder removed
- Check Start Menu shortcut removed
- Check registry key removed (optional)
To change the installer version:
- Open
MemoryMonitorSetup\Package.wxs - Update the Version attribute:
<Package Version="1.0.0.0" ... >- Rebuild installer
Version format: Major.Minor.Build.Revision
- Example:
1.0.0.0?1.1.0.0(minor update) - Example:
1.0.0.0?2.0.0.0(major update)
Edit the batch file, change:
dotnet build ... -v minimalTo:
dotnet build ... -v detailedApplication build log:
dotnet build "Memory Monitor\Memory Monitor.csproj" -c Release > app_build.log 2>&1Installer build log:
dotnet build "MemoryMonitorSetup\MemoryMonitorSetup.wixproj" -c Release > installer_build.log 2>&1The batch file uses these variables:
| Variable | Purpose | Example |
|---|---|---|
| SOLUTION_ROOT | Root directory | C:\...\Memory-Monitor\ |
| PROJECT_PATH | Application project | Memory Monitor\Memory Monitor.csproj |
| INSTALLER_PROJECT | Installer project | MemoryMonitorSetup\...wixproj |
| BIN_PATH | Build output | Memory Monitor\bin\Release\... |
| MSI_PATH | Installer output | MemoryMonitorSetup\bin\...msi |
Required files for building installer:
Memory-Monitor\
??? Build-Installer.bat ? New easy-to-use builder
??? Memory Monitor\
? ??? Memory Monitor.csproj ? Application project
? ??? [source files]
??? MemoryMonitorSetup\
??? MemoryMonitorSetup.wixproj ? Installer project
??? Package.wxs ? Installer definition
??? Build-Installer.ps1 ? PowerShell version
??? HarvestFiles.bat ? File harvester (optional)
Build-Installer.bat # Build
Build-Installer.bat clean # Clean
Build-Installer.bat rebuild # Clean + Build
Build-Installer.bat test # Build + Test Installmsiexec /i MemoryMonitorSetup.msi # Interactive install
msiexec /i MemoryMonitorSetup.msi /quiet # Silent install
msiexec /i MemoryMonitorSetup.msi /l*v log.txt # With loggingmsiexec /x MemoryMonitorSetup.msi # Interactive uninstall
msiexec /x MemoryMonitorSetup.msi /quiet # Silent uninstallIf you encounter issues:
- Review error messages carefully
- Check prerequisites are installed
- Verify project structure is correct
- Check build logs for detailed errors
The Build-Installer.bat file provides:
? Easy to use: Just double-click to build ? Automatic checks: Verifies prerequisites ? Auto-install: Installs WiX if missing ? Clear output: Shows what's happening ? Error handling: Helpful error messages ? Multiple modes: Build, clean, rebuild, test ? Test installation: Quick testing built-in
Perfect for developers who want a simple one-click build process without dealing with command-line details!