zoukankan      html  css  js  c++  java
  • [转]How do I run msbuild from the command line using Windows SDK 7.1?

    本文转自;http://stackoverflow.com/questions/6319274/how-do-i-run-msbuild-from-the-command-line-using-windows-sdk-7-1

    Q:

    I'm setting up .NET 4.0 support on our CI server. I've installed .NET 4.0, and the .NET tools from the Windows 7.1 SDK.

    On .NET 2.0 and 3.5, that just worked. With .NET 4, when I run the "Windows SDK 7.1 Command Prompt" from the Start menu, it complains about

    The x86 compilers are not currently installed. x86-x86
    Please go to Add/Remove Programs to update your installation.
    .
    Setting SDK environment relative to C:Program FilesMicrosoft
    SDKsWindowsv7.1
    .
    Targeting Windows Server 2008 x86 Debug
    

    Then when I try to run msbuild, I get:

    C:Program FilesMicrosoft SDKsWindowsv7.1>msbuild
    'msbuild' is not recognized as an internal or external command,
    operable program or batch file.
    
    C:Program FilesMicrosoft SDKsWindowsv7.1>
    

    I can't quite believe that installing the runtime and SDK will leave you with a system that can't run msbuild... have I missed some obvious step or obscure Windows Update, or is time to give up and start hacking the system path?

    A1:

    173down voteaccepted

    To enable msbuild in Command Prompt, you simply have to add the path to the .NET 4 Framework install on your machine to the PATH environment variable.

    You can access the environment variables by:

    1. Right clicking on Computer
    2. Click Properties
    3. Then click Advanced system settings on the left navigation bar
    4. On the next dialog box click Environment variables
    5. Scroll down to PATH
    6. Edit it to include your path to the framework (don't forget a ";" after the last entry in here).

    For reference, my path was C:WindowsMicrosoft.NETFrameworkv4.0.30319.

    A2:

    From Visual Studio 2013 onwards, MSbuild comes as a part of Visual Studio. Earlier, MSBuild was installed as a part of. NET Framework.

    MSBuild is installed directly under %ProgramFiles%. So, the path for MSBuild might be different depending on the version of Visual Studio.

    For Visual Studio 2015, Path of MSBuild is "%ProgramFiles(x86)%MSBuild14.0BinMSBuild.exe"

    For Visual Studio 15 Preview, Path of MSBuild is "%ProgramFiles(x86)%MSBuild15.0BinMSBuild.exe"

    Also, Some new MSBuild properties has been added and some have been modified. For more information look here

    Update 1: VS 2017

    The location for the MSBuild has changed again with the release of Visual Studio 2017. Now the installation directory is under the %ProgramFiles(x86)%Microsoft Visual Studio2017[VS Edition]15.0Bin. Since, i have an Enterprise edition, the MSBuild location for my machine is

  • 相关阅读:
    亿级 Web 系统的容错性建设实践
    Spring 4支持的Java 8新特性一览
    Java多线程干货系列—(一)Java多线程基础
    Sublime Text 2 实用快捷键(Mac OS X)
    spring-事务管理
    100 个 Linux 常用命令大全
    这些年MAC下我常用的那些快捷键
    Java 容器源码分析之HashMap多线程并发问题分析
    MySQL索引结构--由 B-/B+树看
    Java 容器之 Connection栈队列及一些常用
  • 原文地址:https://www.cnblogs.com/freeliver54/p/6700556.html
Copyright © 2011-2022 走看看