I'm trying to suppress the command-line from the output in Visual Studio - my plan is to add /nologo to the command-line - but I can't find a place in the application settings or in the IDE settings to do this.
I'm probably missing something obvious, but would really appreciate any enlightenment.
Edit: What is causing me the problem can best be described by the following scenario:
I have a solution with multiple projects
I hit F7, to build all (or all currently configured to build via the Configuration Manager)
I hit F4 to step through the warnings/errors in the project(s)
At the start of every project's output (which is usually 0 warnings and 0 errors) is a statement such as the following:
"c:\WINDOWS\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:TRACE /reference:"c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug:pdbonly /filealign:512 /optimize+ . . ."
The fact that these are output for every project (esp. when those projects don't have warnings or errors) makes my stepping any bona-fide warnings/errors a right royal PITA. I want to have the IDE not display these pointless information lines.
Tools | Options | Projects and Solutions | Build and Run | MSBuild project build output verbosity -> Quiet
The question isn't quite clear. By default in VS2005, if you right-click a project, select properties, and look under Configuration Properties -> C/C++ -> General, I think you'll see Suppress Startup Banner: Yes (/nologo)
This suppresses some banner info from the compiler. Is that what you want?
Related
How do I turn off code analysis? In the c++ vcxproj project properties, I've tried unchecking my_proj.vcxproj -> properties -> code analysis -> enable code analysis on build. However, when I build with verbose logging, I can see code analysis in the build command.
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.x\bin\HostX64\x64\CL.exe" /c /I<lots_of_include_paths> /Zi /JMC /nologo /W4 /WX /diagnostics:classic /sdl /MP3 /Od /D CODE_ANALYSIS ... /analyze /analyze:plugin"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.x\bin\HostX64\x64\localespc.dll" /analyze:plugin"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.x\bin\HostX64\x64\EspXEngine.dll" ... my_file.cpp
Within this command there are 2 sections that start with "/analyze:plugin". One for EspXEngine.dll and one for localespc.dll. localespc has been causing problem on some machines at work so I want to delete it from the build command. I suspect there is something in the vcxproj xml but I haven't found it yet.
I tried adding `/analyze- /analyze /analyze:plugin"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.x\bin\HostX64\x64\EspXEngine.dll" to additional properties. This works but give new warnings on D9025.
Missing from my original question was order of the XML in my .vcxproj. I don't know how but my <PropertyGroup...><RunCodeAnalysis>... was near the bottom of the file. Deleting the block and letting visual studio recreate it using the checkbox, placed it higher up in the XML.
Microsoft Documentation states that Order Matters in the vcxproj file which is defined here. https://learn.microsoft.com/en-us/cpp/build/reference/vcxproj-file-structure?view=msvc-170#impact-of-incorrect-ordering
Right-click on the solution title in the Solution Explorer window, then go to Configuration Properties -> Configuration. The table appears, showing check-boxes, allowing to turn off/on a build of particular projects for certain configurations.
My solution and projects are generated with CMake.
Is it possible to turn off a particular project for Debug build configuration from CMakeLists.txt?
==
Background of a problem is failing build of Cython project for Debug config.
Release builds fine. CMake module was taken from this example on Github.
Debug config wants debug Python library python27_d.lib, that is forced by pyconfig.h. I use Anaconda python, which is missing this library.
Moreover, I don't need debug build of that project. I've unsuccessfully spent several hours, modifying CMakeLists.txt in various ways, trying to remove definition of _DEBUG macro from compiler command line. CLI parameter /D_DEBUG was absent in all dialogs with properties and "complete command line" listings, that Visual Studio has shown me. Nevertheless, something has always appended it.
So, I'd like to simply disable this project in Debug build for now.
This sets that check-box from the first part of the question to unchecked state:
set_property(TARGET <my Cython module>
PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)
Now I wonder, where did compiler command line come from, because /D_DEBUG was absent in all dialogs with properties, that Visual Studio has shown me (second part of the question).
I am building this project in VS2013. Initially, that string /D_DEBUG was present in Project properties -> C/C++ -> Preprocessor -> Preprocessor definitions for the Debug configuration. Then I've added
string(REPLACE "/D_DEBUG" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
to my CMakeLists.txt file, building the Cython code, and that macro has disappeared from the Project properties.
Nevertheless, the project was still requiring python27_d.dll.
I've also added
#define _DEBUG
in one of files, and have got the following compiler warning
C:\projects\project\file.cpp(9): warning C4005: '_DEBUG' : macro redefinition
command-line arguments : see previous definition of '_DEBUG'
I right-clicked on my C++ project - Properties - Configuration Properties - Build Events - Post-Build Event and set the command line to calc.
I now do Build - Rebuild Solution and although I get this in the Output pane Calculator never launches.
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
I even tried Configuration Properties - Custom Build Step - General and set the command line to notepad and Execute After to CoreBuild but nothing happened on Rebuild Solution either.
NB: My Post-Build event is actually a copy command but since that isn't working I wanted to break it down to something simpler.
I inherited this project and it had several configurations in it (ANSI Debug/Release and Unicode Debug/Release).
Since I am only targeting Unicode I manually removed those sections from the sln and vcxproj files.
With this in mind, it then became clearer that Visual Studio was showing different options for different configurations.
After switching to the All Configurations options and deleting from the other sections I could make calc run.
xcopy still failed for a while as $(TargetPath) didn't resolve correctly when the OuputFile option had been changed in the Linker to suffix "_Debug" for the debug config.
It all seems to work now.
We need to surpress generation of debug symbols. The options availble under project properties/ configuration properties / c/c++ / general / debug information format, are equivalent to /Z7, /Zi and /ZI - I can't find a way to omit the /Zx flag entirely.
Unlike the situation here - we're building from the IDE.
I'm using visual studio 2010, and the project at hand is a static library.
EDIT:
Here's the view from my installation of VS2012. Is this some installation issue?? Are your Debug-Information-Format options different?
You can remove it manually:
Step 1. Compiler.
Selected "Configuration Properties > C/C++ > General > Debug Information Format"
Hit DEL
Step 2. Linker.
Also you need to disable generating Debug info for Linker
Selected "Configuration Properties > Linker > Debugging> Generate Debug Info" set to No
Step 3. Profiler.
Also set "Profile" to "No" in Linker > Advanced or you may still see PDB files generated!
First thing first - this is not recommended to disable .PDB generation, even for a Release Build!
Anyway, you just need to go:
Linker -> Debugging -> Generate Debug Info, and set it to No
I am using Visual Studio Express 2012. Where is the location of the log file? I have searched in the folder where my solution and projects are stored, but cannot find any .log file.
This is the configuration for logging:
Log file from Visual Studio is only supported for C++ projects. You just have to work with the output window for others.
See this similar thread: VS2010: minimal build log in output and detailed log in log file
And in case you happen to do this for a C++ project, the file is at:
... build log in the intermediate files directory
... The path and name of the build log is represented by the MSBuild macro
expression, $(IntDir)\$(MSBuildProjectName).log.
Use build output instead of logging to file. Instead of copy/paste, simply click somewhere in the output and press CTRL + S to save. Visual Studio will prompt you for a location (tested with Visual Studio 2017, but I'm assuming this works in earlier versions too).
The msdn documentation is pretty clear about this (And you ain't gonna like it!):
https://msdn.microsoft.com/en-us/library/jj651643.aspx
Where it says:
To create a build log file for a managed-code project On the menu bar,
choose Build, Build Solution.
In the Output window, highlight the
information from the build, and then copy it to the Clipboard.
Open a
text editor, such as Notepad, paste the information into the file, and
then save it.
While it's true that VS doesn't allow this directly, it is still possible to build with MSBuild "inside" VS2015 and get both the build window output and the log file, as follows: (Arguably this is a bit of a hack.)
In your VS Managed solution, add a new project (Let's call it 'Make').
a. The project type you want is Visual C++/NMake project.
Define the MSBuild commands you need on the command line (see below).
Change the solution configuration to build the NMake project instead of the normal managed projects.
This will create a project that has Build, Rebuild, and Clean command lines where you can execute MSBuild directly. For example:
Rebuild: MSBuild.exe /ds /v:diag /property:Configuration=Debug ..\BuildTest\BuildTest.csproj /t:Clean,Build
Build: MSBuild.exe /ds /v:diag /property:Configuration=Debug ..\BuildTest\BuildTest.csproj /t:Build
Clean: MSBuild.exe /ds /v:diag /property:Configuration=Debug ..\BuildTest\BuildTest.csproj /t:Clean
You can also specify multiple MSBuild.EXE command lines in order to build multiple projects. For the usual build-the-entire-solution outcome you can target only the final end assemblies and let the dependency graph generate the individual targets.
This will produce a .log file, where NAME is the name of the NMake project you used. In the example above, the log would be make.log.
A working example is available on GitHub:
https://github.com/bitblitz/VS_MsbuildExample
(Tested with VS2015)
Note that building individual projects directly will still build with the normal VS behavior, but you can build the full solution inside VS and get the build logs.