Showing posts with label Debug. Show all posts
Showing posts with label Debug. Show all posts

Monday, October 15, 2012

Visual Studio not automatically building application on pressing F5 key


Recently I was facing one issue with Visual Studio 2010. When I change some code in Visual Studio 2010 and hit F5, it is not building application and running old compiled version. Every time I want to debug an application, I have to first manually build application and then hit F5  key to debug my application. Usually visual studio automatically builds application on hitting F5 key.

I found interesting solutions from internet to resolve this issue. You need to open the Configuration Manager from Debug Dropdown or right click on Solution and open Configuration Manager Window. Now click on Build Checkbox.


Another solution would be useful if your Project is out of date or you have installed newer version. Go to Tool -> Option -> Project and Solutions -> Build and Run from Visual Studio. Now select “Always build” or “Prompt to build” option of “On Run, when project are out of date”.


Hope this small Tip might help you to fix this issue.

See Also –

Tuesday, April 10, 2012

How to modify/create build configurations in Visual Studio?



In project life cycle you might need to create or access various builds like Development, Testing, User Acceptance Testing, Production etc. Visual Studio provides Configuration Manager Toolbar to change, create or access builds. By default solution has two builds Debug and Release.

Typically debug build is used to debug and detect errors (compile-time and runtime) from solution or project. Once project or solution development is complete and ready to deploy than project or solution should be built in Release mode. Release builds enables code optimization and enables fast execution of program.

You can also change or create new configuration using configuration dropdown available on standard toolbar.


For add or change configuration you can select configuration manager from any of the drop down. If sometimes configuration or platform drop downs are not visible on standard tool bar of visual studio in such case you can add those externally by clicking on customize menu item of tools menu.


The Configuration Manager Dialog will appear.


Similarly you can open Configuration Manager Dialog from right click of your solution and click on Configuration Manager (below image).

You can change or edit configuration and platform for each project under solution.


The same configuration used to develop application to choose correct config file or connection string or other configuration specific task. Let’s have a look on below code.

#if DEV
        Console.WriteLine("DEV Configuration...");
#elif QA
        Console.WriteLine("QA Configuration...");
#endif

As per above code, based on selected configuration either DEV or QA the appropriate code will execute. One more thing, by default Debug and Release configuration added with project and during compilation it will create Debug and Release folder under Bin folder located at solution folder. If we added new configurations in our case DEV and QA then respective folder will get created under solution’s Bin folder and respective resource and assembly will be added to that.