zoukankan      html  css  js  c++  java
  • 用资源管理器右键编译 Visual Studio 解决方案文件

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

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

    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOTVisualStudio.Launcher.slnShell]
    
    [HKEY_CLASSES_ROOTVisualStudio.Launcher.slnShellBuild Debug]
    @="使用 VCBuild 编译 Debug(&D)"
    
    [HKEY_CLASSES_ROOTVisualStudio.Launcher.slnShellBuild DebugCommand]
    @="cmd.exe /K ""C:\Program Files\Microsoft Visual Studio 9.0\VC\vcpackages\vcbuild.exe" "%1" "Debug|Win32"""
    
    [HKEY_CLASSES_ROOTVisualStudio.Launcher.slnShellBulild Release]
    @="使用 VCBuild 编译 Release(&R)"
    
    [HKEY_CLASSES_ROOTVisualStudio.Launcher.slnShellBulild ReleaseCommand]
    @="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_ROOTVisualStudio.Launcher.slnShell]
    
    [HKEY_CLASSES_ROOTVisualStudio.Launcher.slnShellBuild Debug]
    @="使用 MSBuild 编译 Debug(&D)"
    
    [HKEY_CLASSES_ROOTVisualStudio.Launcher.slnShellBuild DebugCommand]
    @="cmd.exe /K "C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /m "%1" /p:Configuration=Debug /t:Build""
    
    [HKEY_CLASSES_ROOTVisualStudio.Launcher.slnShellBulild Release]
    @="使用 MSBuild 编译 Release(&R)"
    
    [HKEY_CLASSES_ROOTVisualStudio.Launcher.slnShellBulild ReleaseCommand]
    @="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_ROOTVisualStudio.Launcher.csproj.12.0Shell]
    
    [HKEY_CLASSES_ROOTVisualStudio.Launcher.csproj.12.0ShellBuild Debug]
    @="使用 MSBuild 编译 Debug(&D)"
    
    [HKEY_CLASSES_ROOTVisualStudio.Launcher.csproj.12.0ShellBuild DebugCommand]
    @="cmd.exe /K "C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /m "%1" /p:Configuration=Debug /t:Build""
    
    [HKEY_CLASSES_ROOTVisualStudio.Launcher.csproj.12.0ShellBulild Release]
    @="使用 MSBuild 编译 Release(&R)"
    
    [HKEY_CLASSES_ROOTVisualStudio.Launcher.csproj.12.0ShellBulild ReleaseCommand]
    @="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_ROOTVisualStudio.Launcher.vcxproj.12.0Shell]
    
    [HKEY_CLASSES_ROOTVisualStudio.Launcher.vcxproj.12.0ShellBuild Debug]
    @="使用 MSBuild 编译 Debug(&D)"
    
    [HKEY_CLASSES_ROOTVisualStudio.Launcher.vcxproj.12.0ShellBuild DebugCommand]
    @="cmd.exe /K "C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /m "%1" /p:Configuration=Debug /t:Build""
    
    [HKEY_CLASSES_ROOTVisualStudio.Launcher.vcxproj.12.0ShellBulild Release]
    @="使用 MSBuild 编译 Release(&R)"
    
    [HKEY_CLASSES_ROOTVisualStudio.Launcher.vcxproj.12.0ShellBulild ReleaseCommand]
    @="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 来编译则不会存在此问题)。

  • 相关阅读:
    Xfire的aegis绑定方式配置小结
    ExtJS入门
    InstallScript 中数组的使用
    [转]手把手教你用C#(.NET)打包应用程序(安装程序)【卸载模块已添加】
    [VB]全局钩子
    VB.NET 反射机制取得当前函数名 类名等
    [.Net][转]dotNet取得各种系统信息
    [VB]清空Clipboard
    [VB]取得本机的网络连接(类似netstat 命令)
    [InstallShield] 安装时添加一个进度对话框Dialog
  • 原文地址:https://www.cnblogs.com/zjoch/p/4423970.html
Copyright © 2011-2022 走看看