If I build a solution in VS2005, will the build go to both bin/Debug and bin/Release? Or do I need to specify something?
No, it only goes into what release you've specified VS to build under. There should be a dropdown in your standard toolbar that specifies whether it's Debug, Release or any other custom build configuration that you've specified.
In this image it's set to debug (from the red highlight on the top of the screenshot) so will by default go to bin\Debug.
Related
I was a CLION user for long, and until recently I switched to visual studio 2017 since CLION uses too much memory.
In CLION, basically I can cmake the whole project with the top-level cmake file and generates multiple targets to select from a drop-down button.
I did the same in visual studio except in visual studio I need to run the cmake first to generate a .sln file and open it in visual studio.
After open this, I can see different class instances(my targets) in the solution explorer, but I do not know where to specify which target to run. Each of my target has its own main function. Also, I have integrates all my targets into a top level object called BUILD_ALL. I can build this build_all which builds all of my individual target. But still i dont know how to run each one.
I tried by using the right-click and start a new instance, but it rebuilds the target everytime which is not wanted. In Clion, this is not a problem.
Could someone help on this?
Thanks in advance.
I would suggest using the Set as Startup Project option. This will make it so the build and debug shortcuts target the selected project.
Right click on the project in the solution explorer and choose Set as Startup Project
Another option is to just build and or debug the project directly from the right click context menu.
Depending on how much you work with CMake and Visual Studio you may want to look into VS_STARTUP_PROJECT
In VS 2010, or VS 2012, you can pick a "Solution Configuration", that has been custom defined, that can define local variables used with the #if #elif #endif syntax to change your code dynamically through that drop down. Also in that configuration, you can choose whether it's built or deployed, platform you're targeting, and the local configuration you want to use per project.
When you choose a configuration, then close Visual Studio, and re-open Visual Studio, it remembers what configuration you chose, what I can't seem to figure out, is where it saves/stores that configuration information, and I need to automate it.
Does anyone know of either:
A way to use the command line compiler to automate solution level builds using solution configurations
Where Visual Studio stores the currently selected configuration information
Or, ideally, both?
Visual Studio actually stores a solution's build configuration selections in the solution file itself. Even though the "*.suo" file is not checked into version control, the solution's build configuration selections will propagate to other machines that are sync'ed to the same version control system.
If you open a "*.sln" file, you will see a section called "GlobalSection(ProjectConfigurationPlatforms)". If a project is not checked for build or deploy, you will see something like this:
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU
The ".0" strings indicate that the the build and deploy are unchecked.
A way to use the command line compiler to automate solution level builds using solution configurations
msbuild.exe /p:Configuration="Solution Config" /p:Platform="Solution Platform"
For example, you can do:
msbuild.exe /p:Configuration="Release" YourSolution.sln
To build the "Release" configuration.
Where Visual Studio stores the currently selected configuration information
This is stored in the user's .suo file, next to the .sln (solution) file.
I used to have the environment optimized for c# but recently I have been doing a mostly c++ work. So after a format, I selected c++ instead. Once in a while I still do some c#/xna stuff so I installed xna as well. Problem is that visual studio does not behave anything like I remember it behaving when I had the environment optimized for c#. The run button no longer compiles the solution. Hell, compiling the solution does nearly nothing... I need to recompile for my changes to take effect. What the hell?
I have tried Tools > Import and Export Settings > Reset all settings, reinstalling xna and visual studio and still the F5 does not compile.
edit: Turns out that the projects were set to not compile under the configuration options. I never set this though. I found a forum with several people who had the same issue: http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/8657c07a-da08-4a9f-9558-0c9d93c94ce2/
If you have a number of configurations, it's possible that the currently selected configuration doesn't have the project (you want to auto-build) in it.
For example.
The default configurations are DEBUG and RELEASE and all the projects (in the solution) are ticked against this.
But if you've manually un-ticked a project against one of these configurations OR you've manually added a new project and then un-ticked that project in the configuration .. Visual Studio won't compile those un-ticked projects.
So double check your configuration. (Right Click on the Solution name => Configuration Manager).
I hope this will fix your problem: Start debugging F5 does not build automatically, Visual Studio.
First check what should happen when you run a project. To do this, open Tools > Options, Projects and Solutions, Build and Run, and check that you have selected for the On Run, when projects are out of date option:
Make sure you have selected Always Build...
To change you settings:
Tools -> Import and Export Settings
Choose: Import selected environment settings
Save you settings if you want
You are then presented with a set of default settings to choose from (General, C++, C#)
Is it possible to change some setting so that Visual Studio always use the "release" configuration when publishing?
I use debug mode when i develop to clear some caches and stuff like that and i also have different web.configs for release and debug. Sometimes when i publish i forget to change the configuration to release and i end up with a broken website ;)
I understand i can do this with MS Build or something but publish working fine except for this. Any tips?
In Solution Explorer, select the project.
On the View menu, click Property Pages.
Click the Build or Debug tab, in a Visual C# or a Visual F# project, the Compile or Debug tab, in a Visual Basic project, or Configuration Properties, in a Visual C++ project.
In the Configuration drop-down list, click Debug or Release."
Steps provided by:
http://msdn.microsoft.com/en-us/library/wx0123s5.aspx
As of at least VS 2017, the web publish settings now include a setting for which configuration to publish, which defaults to Release, so you can publish the release build even when VS is still in Debug configuration.
I just wish that they had also done this for regular Click-Once applications as well...
Or should I just copy all the files from bin\Release\ excluding .pdb?
UPD:
UPD 2:
That is what I've found in the Advanced settings at the Build tab. Is it what I'm looking for?
To make a release build in VS 2010 express you need to change the build configuration for the project from Debug to Release.
To do this you need to access the configuration manager which is hidden by default in VS 2010 Express Editions, to enable it Click Tools > Settings > Expert Settings
Configuration Manager should now appear as an option in the Build menu and you should be able to change the active build configuration from Debug to Release
Changing build config may have a verity of different consequences including:
Not producing debug symbols for the generated assemblies (.pdb files)
Undefines the DEBUG compilation symbol meaning that any code conditionally included with the symbol will not be in the resulting assembly
The compiler optimizer is enabled which could mean that the IL generated is slightly different than what would normally be generated depending upon what optimizations the optimizer can make
The exact settings used in each build configuration can be viewed and edited on the Build tab of the project Properties page.
To see the build configuration selection combo boxes on the Build tab you need to enable the "Show advanced build configurations" check box on the General page of the Projects and Solutions option group which is visible when Show All Options is checked (as pictured below
With this option checked the Build tab of the project should include a Configuration section which you can use to control which build configuration the tab displays