I have very big solution, and it compiling every time I'm tring to debug.
So I know that I can to disable building of all projects at all in solution configuration, but is there way to say to Visual Studion to compile only changed code?
I sure that is.
Thank you for ahead.
Build Solution - compiles code files (dll and exe) that have changed. Rebuild Solution - Deletes all compiled files and Compiles them again regardless of whether or not the code has changed.
For a multi-project solution, "rebuild solution" does a "clean" followed by a "build" for each project (possibly in parallel). Whereas a "clean solution" followed by a "build solution" first cleans all projects (possibly in parallel) and then builds all projects (possibly in parallel).
To build, rebuild, or clean an entire solution Choose Clean All to delete any intermediate and output files. With only the project and component files left, new instances of the intermediate and output files can then be built.
As Marnix and Anton already said this is what VS normally does. But if you have a lot of projects within your solution which depend on each other and you make changes to a component which will be used by all or most of the other projects it has to build also the others again to make sure everything works as expected.
So if it starts to recompile even if you didn't make any change we need to find out how VS tries to find out what it needs to do on a incremental build.
For this it simply checks the datetimes of every file and if there are any changes. If yes, recompile that file and all its dependents (e.g. changes in a stdafx.h will result in a complete rebuilt, cause normally every source file will reference to this one).
But there are also exceptions to this behaviour. A setup project for example will always rebuilt, even if there are no changes made (due to this fact I normally exclude the setup project from the build process and start it only manually when needed).
So if you only have C/C++, C#, VB etc. project which normally support incremental builds there must be something that changes between two builds, even if you don't change anything.
Here are some possibilities:
[assembly: AssemblyVersion("1.0.*")]
or some other external process to increase the build numberIf one of the above steps happens to a module from which all or most of your other projects depends on than everything needs to be rebuilt.
Visual Studio actually does that out of the box if you do a Build (not a Rebuild). However, it'll deal with some project types better than others. For example a setup or deployment project will always be built.
You could unload any project that you don't need to speed up the build.
Additionally, I find it works well to start the application without debugging and attach the debugger once the application is running. From what I can tell this minimizes the number of debug symbols being loaded to what is actually being used by the running application.
As far as I know MSBuild (the build engine used by VS) will auto-detect what to rebuild based on what files have been changed. So make sure you don't have any generated files that are updated with each build. For example, when you update the (assembly) version using source control meta data. Any changed file will trigger a build of all the projects that use it and all the projects that depend on them. A setup like this will effectively rebuild most of your application every time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With