MFC 1.3 · Шаг 4. Сборка из командной строки
Что будет сделано на этой странице. Вы соберёте TMC Suite без открытия Visual Studio — программой MSBuild из окна Developer PowerShell for VS. Здесь даны точные команды для всех четырёх сочетаний (Release/Debug × x64/Win32), команда «собрать всё одним разом», запись полного журнала сборки в файл, сборка одного проекта и очистка. Все команды на этой странице проверены реальной сборкой.
Перед этим шагом должны быть выполнены шаг 1 и шаг 2. Этот шаг можно делать вместо шага 3 — результат одинаковый.
4.1 Откройте окно разработчика
Обычное окно PowerShell или «Командная строка» не знает команду msbuild (будет ошибка
«msbuild не распознано…», см. шаг 7).
Нужно специальное окно, в котором Visual Studio заранее прописала пути к своим инструментам.
Способ 1 (проще всего): ярлык в меню «Пуск»
- Нажмите Пуск и начните набирать
Developer PowerShell. - Выберите Developer PowerShell for VS (папка Visual Studio Tools в меню «Пуск»).
- Откроется синее окно PowerShell с заголовком
** Visual Studio 2026 Developer PowerShell v18.0.
Вместо него можно взять Developer Command Prompt for VS (чёрное окно cmd) — команды
msbuild ниже работают в нём так же; отличия отмечены в пункте 4.6.
Способ 2: из обычного окна PowerShell
Если ярлыка нет или вы уже работаете в обычном PowerShell, выполните по очереди:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force
$vs = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath
& "$vs\Common7\Tools\Launch-VsDevShell.ps1" -Arch amd64 -HostArch amd64 -SkipAutomaticLocation
- Первая строка разрешает запуск сценариев только в этом окне (без неё Windows может
запретить запуск
Launch-VsDevShell.ps1). Настройки компьютера она не меняет. - Вторая находит папку Visual Studio (например,
C:\Program Files\Microsoft Visual Studio\18\Community). - Третья превращает окно в окно разработчика; появится строка
** Visual Studio 2026 Developer PowerShell v18.0.
Иногда при этом печатается строка
"vswhere.exe" не является внутренней или внешней командой, исполняемой программой или пакетным файлом.Это сообщение служебного сценария Visual Studio, на сборку оно не влияет (проверено: после негоmsbuildработает).
Проверка окна
msbuild -version
Должна напечататься версия, начинающаяся с 18. (проверено: 18.11.1.51303). Если вместо
этого — ошибка, окно не то; вернитесь к способу 1.
4.2 Перейдите в корень проекта
cd C:\src\TMC_Suite
Все команды ниже запускаются из корня проекта и указывают на решение src\tamic.slnx.
Если запустить их из другой папки, будет ошибка MSB1009: файл проекта не существует
(шаг 7).
4.3 Команды для четырёх сочетаний
Каждая команда полностью пересобирает (/t:Rebuild) все 12 проектов в одном сочетании.
Ключ /m включает параллельную сборку на всех ядрах процессора (без него сборка примерно
вдвое дольше, см. 4.5).
Release, 64 бита → dist\win64\bin, dist\win64\lib:
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=Release /p:Platform=x64
Release, 32 бита → dist\win32\bin, dist\win32\lib:
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=Release /p:Platform=Win32
Debug, 64 бита → dist\win64\debug\bin, dist\win64\debug\lib:
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=Debug /p:Platform=x64
Debug, 32 бита → dist\win32\debug\bin, dist\win32\debug\lib:
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=Debug /p:Platform=Win32
Правила написания:
- конфигурация — ровно
ReleaseилиDebug; - платформа — ровно
x64илиWin32(win32строчными тоже принимается — проверено).x86— ошибкаMSB4126: указанная конфигурация решения "Release|x86" недопустима: в решении 32-битная платформа называетсяWin32; - если убрать
/t:Rebuild, MSBuild выполнит обычную сборку (Build) — пересоберёт только изменённое. Для первой сборки разницы нет.
Если ключи /p:Configuration и /p:Platform не указать, MSBuild выберет конфигурацию решения
по умолчанию — какую именно, лучше не гадать: всегда указывайте обе.
Как понять, что сборка прошла успешно
В конце вывода должно быть:
Сборка успешно завершена.
Предупреждений: 0
Ошибок: 0
Прошло времени 00:00:23.90
(в английской версии — Build succeeded., 0 Warning(s), 0 Error(s)). Сразу после команды
можно проверить код возврата:
$LASTEXITCODE
0 — успех, 1 — были ошибки.

4.4 Полный журнал сборки в файл
Вывод MSBuild длинный. Чтобы спокойно его прочитать или отправить при ошибке, пишите его в
файл ключами /fl /flp:…:
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=Release /p:Platform=x64 /fl "/flp:logfile=build_Release_x64.log;verbosity=minimal"
- Файл
C:\src\TMC_Suite\build_Release_x64.logпоявится в корне проекта (расширение.logуже указано в.gitignore, git его не заметит). - Ключ
/flp:…берите в двойные кавычки целиком: в PowerShell точка с запятой;разделяет команды, без кавычек частьverbosity=minimalбудет понята как отдельная команда. Вcmdкавычки не обязательны, но не мешают. verbosity=minimal— только главное (имена файлов, ошибки, итог); для разбора сложной ошибки используйтеverbosity=detailed.
Открыть журнал: notepad build_Release_x64.log.
Важно. Не «обрезайте» вывод MSBuild конвейером — командами вроде
msbuild … | Select-Object -First 50или| more. Когда принимающая сторона перестаёт читать, компилятор может зависнуть. Для просмотра используйте журнал в файле.
4.5 Сколько времени занимает сборка
Реальный замер на компьютере с процессором Intel Core i5-9600KF (6 ядер, 6 потоков),
64 ГБ памяти, Windows 11, Visual Studio Community 2026 18.11.1 (MSVC 14.51, Windows SDK
10.0.28000.0), полная пересборка (/t:Rebuild) чистой копии исходников с GitHub:
| Команда | Время | Ошибок | Предупреждений |
|---|---|---|---|
Release x64, с /m |
23,9 с | 0 | 0 |
Release Win32, с /m |
20,9 с | 0 | 0 |
Debug x64, с /m |
21,1 с | 0 | 0 |
Debug Win32, с /m |
20,3 с | 0 | 0 |
Release x64, без /m |
51,6 с | 0 | 0 |
Повторная сборка без изменений (Build, Release x64) |
2,3 с | 0 | 0 |
Все четыре сочетания подряд командой из пункта 4.6 — 80,8 с (около 1 мин 20 с). На компьютере с меньшим числом ядер — дольше.
4.6 Собрать все четыре сочетания одной командой
Вставьте в Developer PowerShell (из корня проекта) целиком:
foreach ($c in 'Release','Debug') {
foreach ($p in 'x64','Win32') {
$log = "build_${c}_${p}.log"
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=$c /p:Platform=$p /nologo /v:minimal /fl "/flp:logfile=$log;verbosity=minimal"
"{0} {1}: код возврата {2}" -f $c, $p, $LASTEXITCODE
}
}
После окончания будут четыре строки вида Release x64: код возврата 0 и четыре файла журнала
build_<конфигурация>_<платформа>.log в корне проекта. Все коды должны быть 0.
То же в Developer Command Prompt (cmd)
cd /d C:\src\TMC_Suite
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=Release /p:Platform=x64 /fl /flp:logfile=build_Release_x64.log;verbosity=minimal
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=Release /p:Platform=Win32 /fl /flp:logfile=build_Release_Win32.log;verbosity=minimal
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=Debug /p:Platform=x64 /fl /flp:logfile=build_Debug_x64.log;verbosity=minimal
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=Debug /p:Platform=Win32 /fl /flp:logfile=build_Debug_Win32.log;verbosity=minimal
echo %ERRORLEVEL%
(echo %ERRORLEVEL% показывает код возврата последней команды.)
4.7 Сборка одного проекта и очистка
Один проект вместе с нужными ему библиотеками — ключ /t:<имя проекта>:
msbuild src\tamic.slnx /m /t:TMCGROUT /p:Configuration=Release /p:Platform=x64
Проверено: эта команда на чистых исходниках сама собрала complex.lib, exprint.lib,
SFILE95.lib, а затем TMCGROUT.exe. Имена проектов для ключа /t: — как в Обозревателе
решений: complex, exprint, Prepr, SFILE95, TMCIndan, TMCLibError, TMCROS,
TMCGROUT, TMC_DN, PlanRT_H, PlanRT_X, FldView. Для полной пересборки одного проекта:
/t:TMCGROUT:Rebuild.
Не собирайте программу, указывая её
.vcxprojнапрямую (msbuild src\viewers\Tmcgrout\TMCGROUT.vcxproj …), пока не собраны библиотеки: зависимости заданы в решении, а не в проекте, и компоновщик остановится с ошибкойLNK1181: не удается открыть входной файл "sfile95.lib"(проверено).
Очистка (удаляет собранные .exe/.lib и промежуточные файлы выбранного сочетания):
msbuild src\tamic.slnx /m /t:Clean /p:Configuration=Release /p:Platform=x64
Чтобы удалить вообще всё собранное, закройте Visual Studio и удалите папки
C:\src\TMC_Suite\build\obj, C:\src\TMC_Suite\dist\win32 и C:\src\TMC_Suite\dist\win64
(сами исходники при этом не затрагиваются; файл dist\README.md оставьте).
Дальше — Шаг 5. Проверка и пробный запуск.
MFC 1.3 · Step 4. Building from the command line
What this page covers. You will build TMC Suite without opening Visual Studio — with MSBuild from a Developer PowerShell for VS window. Here you will find the exact commands for all four combinations (Release/Debug × x64/Win32), a command to “build everything in one go”, writing the full build log to a file, building a single project and cleaning. All commands on this page have been verified by a real build.
Before this step, step 1 and step 2 must be completed. This step can be done instead of step 3 — the result is the same.
4.1 Open the developer window
A regular PowerShell or Command Prompt window does not know the msbuild command (you get the error
“msbuild is not recognized…”, see step 7).
You need a special window in which Visual Studio has set the paths to its tools in advance.
Method 1 (the easiest): a shortcut in the Start menu
- Click Start and begin typing
Developer PowerShell. - Choose Developer PowerShell for VS (the Visual Studio Tools folder in the Start menu).
- A blue PowerShell window opens with the title
** Visual Studio 2026 Developer PowerShell v18.0.
Instead, you can use Developer Command Prompt for VS (a black cmd window) — the
msbuild commands below work in it in the same way; the differences are noted in section 4.6.
Method 2: from a regular PowerShell window
If there is no shortcut or you are already working in a regular PowerShell, run in turn:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force
$vs = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath
& "$vs\Common7\Tools\Launch-VsDevShell.ps1" -Arch amd64 -HostArch amd64 -SkipAutomaticLocation
- The first line allows running scripts only in this window (without it Windows may
refuse to run
Launch-VsDevShell.ps1). It does not change the computer settings. - The second finds the Visual Studio folder (for example,
C:\Program Files\Microsoft Visual Studio\18\Community). - The third turns the window into a developer window; the line
** Visual Studio 2026 Developer PowerShell v18.0appears.
Sometimes this prints the line
'vswhere.exe' is not recognized as an internal or external command, operable program or batch file.This is a message from a Visual Studio service script; it does not affect the build (verified:msbuildworks after it).
Checking the window
msbuild -version
A version starting with 18. should be printed (verified: 18.11.1.51303). If instead
you get an error, this is the wrong window; go back to method 1.
4.2 Go to the project root
cd C:\src\TMC_Suite
All commands below are run from the project root and point to the solution src\tamic.slnx.
If you run them from another folder, you get the error MSB1009: Project file does not exist
(step 7).
4.3 Commands for the four combinations
Each command fully rebuilds (/t:Rebuild) all 12 projects in one combination.
The /m switch enables a parallel build on all processor cores (without it the build takes about
twice as long, see 4.5).
Release, 64-bit → dist\win64\bin, dist\win64\lib:
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=Release /p:Platform=x64
Release, 32-bit → dist\win32\bin, dist\win32\lib:
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=Release /p:Platform=Win32
Debug, 64-bit → dist\win64\debug\bin, dist\win64\debug\lib:
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=Debug /p:Platform=x64
Debug, 32-bit → dist\win32\debug\bin, dist\win32\debug\lib:
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=Debug /p:Platform=Win32
Spelling rules:
- the configuration is exactly
ReleaseorDebug; - the platform is exactly
x64orWin32(lowercasewin32is also accepted — verified).x86is an error:MSB4126: The specified solution configuration "Release|x86" is invalid; in the solution, the 32-bit platform is calledWin32; - if you remove
/t:Rebuild, MSBuild performs a regular build (Build) — it rebuilds only what has changed. For the first build there is no difference.
If the /p:Configuration and /p:Platform switches are not given, MSBuild chooses the default solution
configuration — rather than guessing which one, always specify both.
How to tell that the build succeeded
At the end of the output there should be:
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:23.90
(in the Russian version — Сборка успешно завершена., Предупреждений: 0, Ошибок: 0). Right after the command
you can check the exit code:
$LASTEXITCODE
0 — success, 1 — there were errors.

4.4 Full build log to a file
The MSBuild output is long. To read it at leisure or send it in case of an error, write it to a
file with the /fl /flp:… switches:
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=Release /p:Platform=x64 /fl "/flp:logfile=build_Release_x64.log;verbosity=minimal"
- The file
C:\src\TMC_Suite\build_Release_x64.logappears in the project root (the.logextension is already listed in.gitignore, git will not notice it). - Put the whole
/flp:…switch in double quotes: in PowerShell the semicolon;separates commands; without quotes the partverbosity=minimalis taken as a separate command. Incmdthe quotes are not required but do no harm. verbosity=minimal— only the essentials (file names, errors, summary); to analyze a complex error, useverbosity=detailed.
To open the log: notepad build_Release_x64.log.
Important. Do not “truncate” the MSBuild output with a pipeline — with commands like
msbuild … | Select-Object -First 50or| more. When the receiving side stops reading, the compiler may hang. To view the output, use the log file.
4.5 How long the build takes
Real measurement on a computer with an Intel Core i5-9600KF processor (6 cores, 6 threads),
64 GB of memory, Windows 11, Visual Studio Community 2026 18.11.1 (MSVC 14.51, Windows SDK
10.0.28000.0), full rebuild (/t:Rebuild) of a clean copy of the sources from GitHub:
| Command | Time | Errors | Warnings |
|---|---|---|---|
Release x64, with /m |
23.9 s | 0 | 0 |
Release Win32, with /m |
20.9 s | 0 | 0 |
Debug x64, with /m |
21.1 s | 0 | 0 |
Debug Win32, with /m |
20.3 s | 0 | 0 |
Release x64, without /m |
51.6 s | 0 | 0 |
Repeated build without changes (Build, Release x64) |
2.3 s | 0 | 0 |
All four combinations in a row with the command from section 4.6 — 80.8 s (about 1 min 20 s). On a computer with fewer cores — longer.
4.6 Build all four combinations with one command
Paste into Developer PowerShell (from the project root) as a whole:
foreach ($c in 'Release','Debug') {
foreach ($p in 'x64','Win32') {
$log = "build_${c}_${p}.log"
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=$c /p:Platform=$p /nologo /v:minimal /fl "/flp:logfile=$log;verbosity=minimal"
"{0} {1}: exit code {2}" -f $c, $p, $LASTEXITCODE
}
}
When it finishes, there will be four lines like Release x64: exit code 0 and four log files
build_<configuration>_<platform>.log in the project root. All codes must be 0.
The same in Developer Command Prompt (cmd)
cd /d C:\src\TMC_Suite
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=Release /p:Platform=x64 /fl /flp:logfile=build_Release_x64.log;verbosity=minimal
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=Release /p:Platform=Win32 /fl /flp:logfile=build_Release_Win32.log;verbosity=minimal
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=Debug /p:Platform=x64 /fl /flp:logfile=build_Debug_x64.log;verbosity=minimal
msbuild src\tamic.slnx /m /t:Rebuild /p:Configuration=Debug /p:Platform=Win32 /fl /flp:logfile=build_Debug_Win32.log;verbosity=minimal
echo %ERRORLEVEL%
(echo %ERRORLEVEL% shows the exit code of the last command.)
4.7 Building a single project and cleaning
One project together with the libraries it needs — the /t:<project name> switch:
msbuild src\tamic.slnx /m /t:TMCGROUT /p:Configuration=Release /p:Platform=x64
Verified: on clean sources this command itself built complex.lib, exprint.lib,
SFILE95.lib, and then TMCGROUT.exe. Project names for the /t: switch are as in Solution
Explorer: complex, exprint, Prepr, SFILE95, TMCIndan, TMCLibError, TMCROS,
TMCGROUT, TMC_DN, PlanRT_H, PlanRT_X, FldView. For a full rebuild of one project:
/t:TMCGROUT:Rebuild.
Do not build a program by specifying its
.vcxprojdirectly (msbuild src\viewers\Tmcgrout\TMCGROUT.vcxproj …) until the libraries are built: the dependencies are set in the solution, not in the project, and the linker stops with the errorLNK1181: cannot open input file 'sfile95.lib'(verified).
Cleaning (deletes the built .exe/.lib and the intermediate files of the selected combination):
msbuild src\tamic.slnx /m /t:Clean /p:Configuration=Release /p:Platform=x64
To delete everything that was built, close Visual Studio and delete the folders
C:\src\TMC_Suite\build\obj, C:\src\TMC_Suite\dist\win32 and C:\src\TMC_Suite\dist\win64
(the sources themselves are not affected; keep the file dist\README.md).
Next — Step 5. Checking and a test run.