每次改动 VC 工程之后都要重新编译,每次 VS 又会生成调试数据库文件,很费时间,于是研究了一下如何在资源管理器中直接编译,还真发现了解决办法。

以下是适用 Visual Studio 2008 的注册表文件,导入系统之后右键点 .sln 文件就会出来编译的菜单了:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\VisualStudio.Launcher.sln\Shell]

[HKEY_CLASSES_ROOT\VisualStudio.Launcher.sln\Shell\Build Debug]
@="使用 VCBuild 编译 Debug(&D)" [HKEY_CLASSES_ROOT\VisualStudio.Launcher.sln\Shell\Build Debug\Command]
@="cmd.exe /K \"\"C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\vcpackages\\vcbuild.exe\" \"%1\" \"Debug|Win32\"\"" [HKEY_CLASSES_ROOT\VisualStudio.Launcher.sln\Shell\Bulild Release]
@="使用 VCBuild 编译 Release(&R)" [HKEY_CLASSES_ROOT\VisualStudio.Launcher.sln\Shell\Bulild Release\Command]
@="cmd.exe /K \"\"C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\vcpackages\\vcbuild.exe\" \"%1\" \"Release|Win32\"\""

自 Visual Studio 2010 开始,微软使用 MSBuild 取代了 Visual C++ 的 VCBuild,所以方法有些不同:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\VisualStudio.Launcher.sln\Shell]

[HKEY_CLASSES_ROOT\VisualStudio.Launcher.sln\Shell\Build Debug]
@="使用 MSBuild 编译 Debug(&D)" [HKEY_CLASSES_ROOT\VisualStudio.Launcher.sln\Shell\Build Debug\Command]
@="cmd.exe /K \"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe /m \"%1\" /p:Configuration=Debug /t:Build\"" [HKEY_CLASSES_ROOT\VisualStudio.Launcher.sln\Shell\Bulild Release]
@="使用 MSBuild 编译 Release(&R)" [HKEY_CLASSES_ROOT\VisualStudio.Launcher.sln\Shell\Bulild Release\Command]
@="cmd.exe /K \"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe /m \"%1\" /p:Configuration=Release /t:Build\""

VS2013中右键编译CSharp项目

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\VisualStudio.Launcher.csproj.12.0\Shell]

[HKEY_CLASSES_ROOT\VisualStudio.Launcher.csproj.12.0\Shell\Build Debug]
@="使用 MSBuild 编译 Debug(&D)" [HKEY_CLASSES_ROOT\VisualStudio.Launcher.csproj.12.0\Shell\Build Debug\Command]
@="cmd.exe /K \"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe /m \"%1\" /p:Configuration=Debug /t:Build\"" [HKEY_CLASSES_ROOT\VisualStudio.Launcher.csproj.12.0\Shell\Bulild Release]
@="使用 MSBuild 编译 Release(&R)" [HKEY_CLASSES_ROOT\VisualStudio.Launcher.csproj.12.0\Shell\Bulild Release\Command]
@="cmd.exe /K \"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe /m \"%1\" /p:Configuration=Release /t:Build\""

VS2013中右键编译CPP项目

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\VisualStudio.Launcher.vcxproj.12.0\Shell]

[HKEY_CLASSES_ROOT\VisualStudio.Launcher.vcxproj.12.0\Shell\Build Debug]
@="使用 MSBuild 编译 Debug(&D)" [HKEY_CLASSES_ROOT\VisualStudio.Launcher.vcxproj.12.0\Shell\Build Debug\Command]
@="cmd.exe /K \"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe /m \"%1\" /p:Configuration=Debug /t:Build\"" [HKEY_CLASSES_ROOT\VisualStudio.Launcher.vcxproj.12.0\Shell\Bulild Release]
@="使用 MSBuild 编译 Release(&R)" [HKEY_CLASSES_ROOT\VisualStudio.Launcher.vcxproj.12.0\Shell\Bulild Release\Command]
@="cmd.exe /K \"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe /m \"%1\" /p:Configuration=Release /t:Build\""

 其他VS版本就自己对着注册表修改就是了,很方便。

注意:使用 MSBuild 的时候会检查环境变量“Platform”,如果不确定配置的是否正确,建议删除该环境变量即可(安装完 Visual Studio 会默认该变量指为 BNB,导致 MSBuild 无法正确编译,但若启动 Visual Studio IDE 来编译则不会存在此问题)。

用资源管理器右键编译 Visual Studio 解决方案文件的更多相关文章

  1. [Cordova] 无法编译Visual Studio项目里Plugin副本的Native Code

    [Cordova] 无法编译Visual Studio项目里Plugin副本的Native Code 问题情景 开发Cordova Plugin的时候,开发的流程应该是: 建立Cordova Plug ...

  2. 为Windows资源管理器右键菜单添加菜单项

    为Windows资源管理器右键菜单添加菜单项 在Windows下命令行用的比较多,经常在资源管理器里翻到某个目录,若想要在此目录下跑命令,只能是打开cmd.exe,然后一路cd才能到达此目录. 每次都 ...

  3. Win7 资源管理器右键固定的文件夹不见了

    把常用的文件夹固定到任务栏的资源管理器右键菜单中 某天突然就不见了! %APPDATA%\Microsoft\Windows\Recent\AutomaticDestinations “最近" ...

  4. 清理Visual Studio解决方案临时文件:Clean Visual Studio Solution Temporary File Build20160418

    复制保存到任意文件名.bat,放置在Visual Studio Solution目录下. 当Visual Studio Solution目录过于庞大或打算拷贝移动Visual Studio Solut ...

  5. Visual studio 创建文件时自动添加备注

    Visual studio 创建文件时自动添加备注 描述 要求每回添加一个类,普通类或单元测试类文件头自动添加备注, 比如:Copyright, FileName, Author and so on. ...

  6. [No00009C]Visual Studio在 解决方案资源管理器 里同步定位打开的文件

    标题的意思就是在使用VS的时候,需要我们打开编辑的文件跟解决方案的资源管理器同步显示,这样方便定位到我们在修改哪个文件. 设置如下: 工具——选项——项目和解决方案——在解决方案资源管理器中跟踪活动项 ...

  7. Visual Studio解决方案的目录结构设置和管理

    摘至:http://blog.csdn.net/lp310018931/article/details/47991759 首先,解决方案和项目文件夹包含关系(c++项目): VS解决方案和各个项目文件 ...

  8. Visual Studio解决方案vs2005/vs2008/vs2010/vs2012/vs2013/vs2015版本互相转换工具

    原文:http://blog.csdn.net/xiejiashu/article/details/52397641   本文转自EasyDarwin团队成员Alex的博客:http://blog.c ...

  9. visual studio 因为文件过期重新编译项目

    最近visual studio总是莫名其妙的重新编译某个工程,  导致大量项目rebuild . 蛋都碎了... 查了好久, 这种无厘头的问题最烦了 参考这篇文章, http://blogs.msdn ...

随机推荐

  1. 洛谷P3396哈希冲突

    传送门啦 非常神奇的分块大法. 这个题一看数据范围,觉得不小,但是如果我们以 $ \sqrt(x) $ 为界限,数据范围就降到了 $ x < 400 $ 我们设数组 $ f[i][j] $ 表示 ...

  2. UVA10212 【The Last Non-zero Digit.】

    暴力可做!!!(十秒还不打暴力!!!)暴力算阶乘边算边取余上代码 #include<iostream> #define int long long //开long long using n ...

  3. 虚拟机的安装以及Linux的学习

    安装虚拟机 对虚拟机的认识 其实初中的时候我就听说过虚拟机这个名词,当时的我还小,也不知道虚拟机是个什么东西,那时我傻傻的认为虚拟机只不过是电脑中的一个虚拟的计算机,没有什么实在的作用.后来随着大学课 ...

  4. EFK收集Kubernetes应用日志

    本节内容: EFK介绍 安装配置EFK 配置efk-rbac.yaml文件 配置 es-controller.yaml 配置 es-service.yaml 配置 fluentd-es-ds.yaml ...

  5. UVA 10559 Blocks(区间DP&&递推)

    题目大意:给你玩一个一维版的消灭星星,得分是当前消去的区间的长度的平方,求最大得分. 现在分析一下题目 因为得分是长度的平方,不能直接累加,所以在计算得分时需要考虑前一个状态所消去的长度,仅用dp[l ...

  6. 【51nod】1851 俄罗斯方块

    题解 最近一遇到神仙题一卡就好久--做点水题滋养一下自己吧= = 显然我们发现放一个方块的奇偶性不会改变,所以格子如果黑格子是奇数,那么就是No 我们发现每个2 × 3的方格里的2 × 1的黑格子都可 ...

  7. 1. python 类型和运算

    类型和运算 (Types and Operations) Introducing Python Object Types 在非正式的意义上, 在 Python 中, 我们用一些东西做事情. " ...

  8. HDU - 3577 Fast Arrangement 线段树

    Fast Arrangement Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  9. <泛> C++3D数学库设计详解 向量篇

    // 注:本内容为作者原创,禁止在其他网站复述内容以及用于商业盈利,如需引用,请标明出处:http://www.cnblogs.com/lv_anchoret/ Preface 为了支持光线追踪的学习 ...

  10. [leetcode sort]148. Sort List

    Sort a linked list in O(n log n) time using constant space complexity. 以时间复杂度O(n log n)排序一个链表. 归并排序, ...