Question

compile a single class/file in visual studio

I just want to know if we can compile a single file/class in visual studio.I often change just a single file but end up compiling the entire project.THis might be a trivial case but will be very helpful:) I am using visual studio 2005 working on C# project in .net 2.0

 45  74376  45
1 Jan 1970

Solution

 55

Ctrl+F7 will compile only the active source file.

Look for the Compile item at the bottom of the Build menu.

Of course, you'll still have to do a build before you can test, but if you just want a quick sanity check after modifying a source file, this can be handy.

2010-02-25

Solution

 4

The granularity of compilation is the DLL, so there is no way to do what you are asking.

Or do you mean that you compile the whole solution for a singe change (or at least VS checks if all projects require building) ? There is an option under 'project and solution' / 'Build and run', 'only build startup projects and dependencies on Run' that helps.

Edited: Ctrl-f7 for 'build file' is for C++ projects.

2010-02-25