开发者

compile a single class/file in visual studio

开发者 https://www.devze.com 2022-12-21 00:39 出处:网络
I just want to know if we can compile a single file/class in visual studio.I often change just a single file bu开发者_高级运维t end up compiling the entire project.THis might be a trivial case but wil

I just want to know if we can compile a single file/class in visual studio.I often change just a single file bu开发者_高级运维t 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


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.


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.


Okay, I think I know what you are looking for. I think there's a better way to word this, but what you need to do, is to open the Visual Studio Command Prompt Found in the Start Menu. Within it you can use the "cl" command to compile C/C++. Usage: cl [ option... ] filename... [ /link linkoption... ]

As in:

cl /O2 test.c


Compile a project — ignoring all irrelevant files. (See also https://stackoverflow.com/a/18940150/2422360 for an answer I wrote that has a fuller look at this.)

0

精彩评论

暂无评论...
验证码 换一张
取 消