Using: Visual Studio 2012 Professional and Ultimate with all latest updates
How do I properly specify the configuration and platform to properly build x86 and x64.
Visual Studio, when you first create a Winforms application gives you two configurations, Debug and Release, with AnyCPU defined as the platform.
If you just target one platform, then the answer is easy, you go to the Build | Configuration Manager and select one of the platforms and then go to the project properties’ build page and select the same platform (x86 or x64) and voila! You wind up with (say you want x86)
/bin/x86/Debug
/bin/x86/Release
I have a solution with one application and multiple dependency projects (DLL assemblies).
Since the VS Configuration Manager has two dropdown lists at the top, Configuration and Platform and then on the project level another configuration and platform, I did the following:
(Before typing further, I think the whole setup sucks, but…)
I created two new configurations Debug64 and Release64 using the top most dropdown and selected Mixed Platforms for the platform.
I selected each of the four main solution configurations in turn and then set the project level configuration and project level platform to match, so:
Debug64 === Debug64, x64
Release64 === Release64, x64
Debug === Debug, x86
Release === Release, x86
I then went into the project properties (Alt + Enter) build page, ignored the platform and selected each configuration in turn and then set the target processor to match. I changed the output to be the following:
Debug64: /bin/x64/Debug
Release64: /bin/x64/Release
Debug: /bin/x86/Debug
Release: /bin/x86/Release
By default, Visual Studio uses the top platform to set the folder and the configuration name to set the last part of the output. If I save and close out of the project properties, then all seems fine. I can build, and wind up with the proper folders.
The problem comes, when I switch solution configurations on the Visual Studio toolbar. The project properties build page reverts back to what it wants by default, namely, say, /bin/x64/Debug64 for both debugs and something similar for the release.
What prompted me to write this issue is that the designer gets confused and cannot find the appropriate library.
I would like to select from the Visual Studio solution configuration dropdown my desired target (Debug x64, Release x64, Debug x86, Release x86) and have it build.
How do I do that? What am I doing wrong?
Creating just two solution configurations, Debug and Release, does not work, because there is no solution platform dropdown, which then targets all sub-projects. Visual Studio has, it seems to me, way too many configurations sections and platform sections. Maybe I am just missing something.
Using: Visual Studio 2012 Professional and Ultimate with all latest updates
How do I properly specify the configuration and platform to properly build x86 and x64.
Visual Studio, when you first create a Winforms application gives you two configurations, Debug and Release, with AnyCPU defined as the platform.
If you just target one platform, then the answer is easy, you go to the Build | Configuration Manager and select one of the platforms and then go to the project properties’ build page and select the same platform (x86 or x64) and voila! You wind up with (say you want x86)
/bin/x86/Debug
/bin/x86/Release
I have a solution with one application and multiple dependency projects (DLL assemblies).
Since the VS Configuration Manager has two dropdown lists at the top, Configuration and Platform and then on the project level another configuration and platform, I did the following:
(Before typing further, I think the whole setup sucks, but…)
I created two new configurations Debug64 and Release64 using the top most dropdown and selected Mixed Platforms for the platform.
I selected each of the four main solution configurations in turn and then set the project level configuration and project level platform to match, so:
Debug64 === Debug64, x64
Release64 === Release64, x64
Debug === Debug, x86
Release === Release, x86
I then went into the project properties (Alt + Enter) build page, ignored the platform and selected each configuration in turn and then set the target processor to match. I changed the output to be the following:
Debug64: /bin/x64/Debug
Release64: /bin/x64/Release
Debug: /bin/x86/Debug
Release: /bin/x86/Release
By default, Visual Studio uses the top platform to set the folder and the configuration name to set the last part of the output. If I save and close out of the project properties, then all seems fine. I can build, and wind up with the proper folders.
The problem comes, when I switch solution configurations on the Visual Studio toolbar. The project properties build page reverts back to what it wants by default, namely, say, /bin/x64/Debug64 for both debugs and something similar for the release.
What prompted me to write this issue is that the designer gets confused and cannot find the appropriate library.
I would like to select from the Visual Studio solution configuration dropdown my desired target (Debug x64, Release x64, Debug x86, Release x86) and have it build.
How do I do that? What am I doing wrong?
Creating just two solution configurations, Debug and Release, does not work, because there is no solution platform dropdown, which then targets all sub-projects. Visual Studio has, it seems to me, way too many configurations sections and platform sections. Maybe I am just missing something.
| title | description | ms.date | ms.topic | f1_keywords | dev_langs | helpviewer_keywords | ms.assetid | author | ms.author | manager | ms.technology | ms.workload | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Set debug and release configurations | Microsoft Docs |
Set debug and release configurations in Visual Studio. You build the debug version for debugging and the release version for the final release distribution. |
01/20/2023 |
how-to |
vs.debug.builds |
|
|
57b6bbb7-f2af-48f7-8773-127d75034ed2 |
mikejo5000 |
mikejo |
jmartens |
vs-ide-debug |
multiple |
Set debug and release configurations in Visual Studio
[!INCLUDE Visual Studio]
Visual Studio projects have separate release and debug configurations for your program. You build the debug version for debugging and the release version for the final release distribution.
In debug configuration, your program compiles with full symbolic debug information and no optimization. Optimization complicates debugging, because the relationship between source code and generated instructions is more complex.
The release configuration of your program has no symbolic debug information and is fully optimized. For managed code and C++ code, debug information can be generated in .pdb files, depending on the compiler options that are used. Creating .pdb files can be useful if you later have to debug your release version.
For more information about build configurations, see Understand build configurations.
You can change the build configuration from the Build menu, from the toolbar, or in the project’s property pages. Project property pages are language-specific. The procedure below shows how to change the build configuration from the menu and the toolbar. For more information about how to change the build configuration in projects in different languages, see the See also section below.
Change the build configuration
To change the build configuration, either:
-
On the toolbar, choose either Debug or Release from the Solution Configurations list.
or
-
From the Build menu, select Configuration Manager, then select Debug or Release.
Generate symbol (.pdb) files for a build (C#, C++, Visual Basic, F#)
You can choose to generate symbol (.pdb) files and what debug information to include. For most project types, the compiler generates symbol files by default for debug and release builds, while other default settings differ by project type and Visual Studio version.
[!IMPORTANT]
The debugger will load only a .pdb file for an executable file that exactly matches the .pdb file that was created when the executable was built (that is, the .pdb must be the original or a copy of the original .pdb file). For more information, see Why does Visual Studio require debugger symbol files to exactly match the binary files that they were built with?.
Each project type may have a different way of setting these options.
::: moniker range=»>=vs-2022″
Generate symbol files for a C# or ASP.NET Core project (.NET Core, .NET 5+ only)
For detailed information on project settings for debug configurations in C#, see Project settings for a C# debug configuration. (For .NET projects in Visual Basic, symbol files are configured the same as in .NET Framework.)
-
In Solution Explorer, right-click the project and choose Properties.
-
In the side pane, choose Build > General.
-
In the Optimize code section, choose Debug or Release.
-
In the Debug symbols list, choose PDB file, current platform, PBD file, portable, or Embedded.
The portable format is the most recent cross-platform format for .NET Core. For more information on options, see Advanced Build Settings dialog box (C#).
-
Build your project.
The compiler creates the symbol file(s) in the same folder as the executable or the main output file.
::: moniker-end
Generate symbol files for a C#, ASP.NET, or Visual Basic project (.NET Framework)
For detailed information on project settings for debug configurations in C# or Visual Basic, see Project settings for a C# debug configuration or Project settings for a Visual Basic debug configuration.
-
In Solution Explorer, right-click the project and choose Properties.
-
In the side pane, choose Build (or Compile in Visual Basic).
-
In the Configuration list at the top, choose Debug or Release.
-
Select the Advanced button (or the Advanced Compile Options button in Visual Basic).
-
In the Debugging information list (or the Generate debug info list in Visual Basic), choose Full, Pdb-only, or Portable.
The portable format is the most recent cross-platform format for .NET Core. For more information on options, see Advanced Build Settings dialog box (C#).
-
Build your project.
The compiler creates the symbol file(s) in the same folder as the executable or the main output file.
Generate symbol files for a C++ project
-
In Solution Explorer, right-click the project and choose Properties.
-
In the Configuration list, choose Debug or Release.
-
In the side pane, choose Linker > Debugging, then select options for Generate Debug Info.
In most C++ projects, the default value is Generate Debug Information (/DEBUG).
For detailed information on project settings for debug configurations in C++, see Project settings for a C++ debug configuration.
-
Configure options for Generate Program Database Files.
In most C++ projects, the default value is
$(OutDir)$(TargetName).pdb, which generates .pdb files in the output folder. -
Build your project.
The compiler creates the symbol file(s) in the same folder as the executable or the main output file.
See also
- Specify symbol (.pdb) files and source files in the Visual Studio debugger
- Debugger settings and preparation
- Project settings for a C++ debug configuration
- Project settings for a C# debug configuration
- Project settings for a Visual Basic debug configuration
- How to: Create and edit configurations
| title | description | ms.date | ms.topic | f1_keywords | dev_langs | helpviewer_keywords | ms.assetid | author | ms.author | manager | ms.technology | ms.workload | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Set debug and release configurations | Microsoft Docs |
Set debug and release configurations in Visual Studio. You build the debug version for debugging and the release version for the final release distribution. |
01/20/2023 |
how-to |
vs.debug.builds |
|
|
57b6bbb7-f2af-48f7-8773-127d75034ed2 |
mikejo5000 |
mikejo |
jmartens |
vs-ide-debug |
multiple |
Set debug and release configurations in Visual Studio
[!INCLUDE Visual Studio]
Visual Studio projects have separate release and debug configurations for your program. You build the debug version for debugging and the release version for the final release distribution.
In debug configuration, your program compiles with full symbolic debug information and no optimization. Optimization complicates debugging, because the relationship between source code and generated instructions is more complex.
The release configuration of your program has no symbolic debug information and is fully optimized. For managed code and C++ code, debug information can be generated in .pdb files, depending on the compiler options that are used. Creating .pdb files can be useful if you later have to debug your release version.
For more information about build configurations, see Understand build configurations.
You can change the build configuration from the Build menu, from the toolbar, or in the project’s property pages. Project property pages are language-specific. The procedure below shows how to change the build configuration from the menu and the toolbar. For more information about how to change the build configuration in projects in different languages, see the See also section below.
Change the build configuration
To change the build configuration, either:
-
On the toolbar, choose either Debug or Release from the Solution Configurations list.
or
-
From the Build menu, select Configuration Manager, then select Debug or Release.
Generate symbol (.pdb) files for a build (C#, C++, Visual Basic, F#)
You can choose to generate symbol (.pdb) files and what debug information to include. For most project types, the compiler generates symbol files by default for debug and release builds, while other default settings differ by project type and Visual Studio version.
[!IMPORTANT]
The debugger will load only a .pdb file for an executable file that exactly matches the .pdb file that was created when the executable was built (that is, the .pdb must be the original or a copy of the original .pdb file). For more information, see Why does Visual Studio require debugger symbol files to exactly match the binary files that they were built with?.
Each project type may have a different way of setting these options.
::: moniker range=»>=vs-2022″
Generate symbol files for a C# or ASP.NET Core project (.NET Core, .NET 5+ only)
For detailed information on project settings for debug configurations in C#, see Project settings for a C# debug configuration. (For .NET projects in Visual Basic, symbol files are configured the same as in .NET Framework.)
-
In Solution Explorer, right-click the project and choose Properties.
-
In the side pane, choose Build > General.
-
In the Optimize code section, choose Debug or Release.
-
In the Debug symbols list, choose PDB file, current platform, PBD file, portable, or Embedded.
The portable format is the most recent cross-platform format for .NET Core. For more information on options, see Advanced Build Settings dialog box (C#).
-
Build your project.
The compiler creates the symbol file(s) in the same folder as the executable or the main output file.
::: moniker-end
Generate symbol files for a C#, ASP.NET, or Visual Basic project (.NET Framework)
For detailed information on project settings for debug configurations in C# or Visual Basic, see Project settings for a C# debug configuration or Project settings for a Visual Basic debug configuration.
-
In Solution Explorer, right-click the project and choose Properties.
-
In the side pane, choose Build (or Compile in Visual Basic).
-
In the Configuration list at the top, choose Debug or Release.
-
Select the Advanced button (or the Advanced Compile Options button in Visual Basic).
-
In the Debugging information list (or the Generate debug info list in Visual Basic), choose Full, Pdb-only, or Portable.
The portable format is the most recent cross-platform format for .NET Core. For more information on options, see Advanced Build Settings dialog box (C#).
-
Build your project.
The compiler creates the symbol file(s) in the same folder as the executable or the main output file.
Generate symbol files for a C++ project
-
In Solution Explorer, right-click the project and choose Properties.
-
In the Configuration list, choose Debug or Release.
-
In the side pane, choose Linker > Debugging, then select options for Generate Debug Info.
In most C++ projects, the default value is Generate Debug Information (/DEBUG).
For detailed information on project settings for debug configurations in C++, see Project settings for a C++ debug configuration.
-
Configure options for Generate Program Database Files.
In most C++ projects, the default value is
$(OutDir)$(TargetName).pdb, which generates .pdb files in the output folder. -
Build your project.
The compiler creates the symbol file(s) in the same folder as the executable or the main output file.
See also
- Specify symbol (.pdb) files and source files in the Visual Studio debugger
- Debugger settings and preparation
- Project settings for a C++ debug configuration
- Project settings for a C# debug configuration
- Project settings for a Visual Basic debug configuration
- How to: Create and edit configurations
Добавлено 27 марта 2021 в 14:13
Конфигурация сборки (build configuration, также называемая целью сборки, build target) – это набор параметров проекта, который определяет, как ваша IDE будет собирать ваш проект. Конфигурация сборки обычно включает в себя такие вещи, как то, как будет называться исполняемый файл, в каких каталогах IDE будет искать другие файлы кода и библиотеки, следует ли сохранять или исключать отладочную информацию, насколько компилятор должен оптимизировать вашу программу и т.д. Чаще всего вы захотите оставить эти настройки в значениях по умолчанию, если у вас не будет особой причины что-то изменить.
Когда вы создаете новый проект в своей IDE, большинство IDE настраивают для вас две разные конфигурации сборки: конфигурацию Release (выпуск, релиз) и конфигурацию Debug (отладка).
Конфигурация Debug (отладка) предназначена для помощи в отладке вашей программы, и обычно, при написании своих программ вы будете использовать ее. Эта конфигурация отключает все оптимизации и включает отладочную информацию, что делает ваши программы крупнее и медленнее, но намного проще для отладки. Конфигурация отладки обычно выбирается как активная конфигурация по умолчанию. Мы поговорим о методах отладки на следующем уроке.
Конфигурация Release (выпуск, релиз) предназначена для использования при выпуске вашей программы для публичного использования. Эта версия обычно оптимизирована по размеру и производительности и не содержит дополнительной отладочной информации. Поскольку конфигурация выпуска включает в себя все оптимизации, этот режим также полезен для тестирования производительности вашего кода (что будет показано в этой серии статей позже).
Когда программа Hello World (из урока «0.7 – Компиляция вашей первой программы») была собрана, используя Visual Studio, исполняемый файл, созданный в конфигурации отладки, имел размер 65 КБ, тогда как исполняемый файл, созданный в версии выпуска, был размером 12 КБ. Разница в значительной степени связана с дополнительной отладочной информацией, хранящейся в отладочной сборке.
Хотя вы можете создавать свои собственные конфигурации сборки, у вас редко будут для этого причины, если только вы не захотите сравнить две сборки, созданные с использованием разных настроек компилятора.
Лучшая практика
При разработке программ используйте конфигурацию сборки Debug (отладки). Конфигурацию сборки Release (выпуска) используйте, когда будете готовы передать свой исполняемый файл другим пользователям или захотите проверить производительность.
Переключение между конфигурациями сборки
Для пользователей Visual Studio
В Visual Studio есть несколько способов переключения между отладкой и выпуском. Самый простой способ – сделать свой выбор прямо из раскрывающегося списка «Конфигурации решения» в параметрах стандартной панели инструментов:
На данный момент установлена конфигурация отладочной сборки.
Вы также можете получить доступ к диалоговому окну диспетчера конфигураций, выбрав меню Сборка (Build) → Диспетчер конфигураций (Configuration Manager), и изменить конфигурацию активного решения.
Для пользователей Code::Blocks
В Code::Blocks на панели инструментов Compiler вы должны увидеть элемент под названием Build Target (цель сборки):
На данный момент установлено значение Debug.
Теги
C++ / CppLearnCppДля начинающихКомпиляторОбучениеОтладкаПрограммирование
Я пытаюсь использовать MSBuild для создания решения с указанной целевой платформой (мне нужны двоичные файлы, x86 и x64). Вот как я попробовал:
C:WINDOWSMicrosoft.NETFrameworkv3.5>MsBuild SolutionPathSolution.sln /t:Rebuild /p:Configuration=Release /p:Platform="x86"
однако сборка всегда терпит неудачу, если платформа отличается от»любого процессора». Что я делаю не так?
это в то время как вывод MSBuild печатает:
C:WINDOWSMicrosoft.NETFrameworkv3.5>MsBuild
РешениеSolutionPath.sln/t: перестроить
/p: конфигурация=выпуск
/ p:Platform= » x86″ Сборка Microsoft (R)
Версия Двигателя 3.5.30729.1 [Microsoft
.NET Framework, версия
2.0.50727.3082] Copyright (C) Microsoft Corporation 2007. Все права
зарезервированный.сборка началась 1.7.2010 8:28: 10.
Проект » Путь РешенияРешение.sln » on
узел 0 (перестроить targe t (s)).
РешениеSolutionPath.СЛН : ошибка
MSB4126: указанное значение sol
конфигурация «Release / x86»
недействительный. Пожалуйста, укажите действительный
решение c onfiguration с помощью
Конфигурация и платформа свойства
(например, MSBuild.решение ехе.ФСЛ
/п:настройки=отладка
/ p:Platform= «Any CPU») или оставить их
prope rties пустой для использования по умолчанию
конфигурация решения. Сделать Дом
Проект » Путь РешенияРешение.ФСЛ»
(Rebuild t arget (s)) — FAILED.ошибка сборки.
«РешениеSolutionPath.sln » (Rebuild
цели) (1) ->
(Цель ValidateSolutionConfiguration)
— >Путь РешенияРешение.sln: ошибка MSB4126: указанное значение
конфигурация «Release / x86»
недействительный. Пожалуйста, укажите действительный
конфигурация решения с использованием
Конфигурация и свойства платформы
(например, MSBuild.ex e решение.ФСЛ
/п:настройки=отладка
/ p:Platform= «Any CPU») или оставить их
pro perties blank для использования по умолчанию
конфигурация решения.0 Warning(s) 1 Error(s)Время Истекло 00: 00: 00.03
Если я попытаюсь построить его для x86 / x64 с devenv, он отлично работает, однако я пытаюсь настроить сервер сборки без установки всех необходимых версий Visual Studio. Кстати, если есть лучший бесплатный инструмент (который поддерживает .NET framework 4), я хотел бы услышать об этом.
3 ответов
в MSBuild или Teamcity используйте командную строку
MSBuild yourproject.sln /property:Configuration=Release /property:Platform=x64
или используйте более короткую форму:
MSBuild yourproject.sln /p:Configuration=Release /p:Platform=x64
однако вам все равно нужно настроить платформу в своем проекте, см. ответ Жюльена Хоарау.
Если вы пытаетесь сделать это из командной строки, вы можете столкнуться с проблемой, когда машинная переменная среды «платформа» устанавливается для вас и работает против вас. Я могу воспроизвести это, если я использую командное окно VS2012 вместо обычного командного окна windows.
в командной строке введите:
установить платформу
в окне команды VS2012 у меня есть значение предустановки «X64». Это, кажется, мешает что бы ни было в моем файле решения.
в обычном командном окне команда » set «приводит к сообщению» переменная не определена»…это хорошо.
Если результат вашей команды » set » выше не возвращает значения переменной среды, вам должно быть хорошо идти.






