views:

80

answers:

3

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

A: 

Maybe this can help you: Snippet Compiler

Luxspes
Thanks Luxspes.But i am looking for a way to compile a file in visual studio.I am not looking for a new tool which does this.:)
Ravisha
A: 

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.

Timores
No thats not wht i am looking for
Ravisha
+1  A: 

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.

Scott Smith
Thats what i wanted.Thanks scott.
Ravisha
Scott, you made me quite curious. How do you get a 'Compile' item at the bottom of the Build menu in VS 2005 in a C# project ? I cannot see it on my copy of VS.
Timores
@Timores - Whoops, I was thinking this was a C++ question; looks like in a C# solution, the smallest thing you can build is a single project, using *Build Selection* (**SHIFT+F6**).
Scott Smith