【问题标题】:How to install MSBuild on OS X and Linux?如何在 OS X 和 Linux 上安装 MSBuild?
【发布时间】:2015-12-09 08:27:05
【问题描述】:

我希望在我的 Linux 笔记本电脑上安装 MSBuild,以便构建我的 C# OSS 项目。我该怎么做呢?我遇到过一些指南,例如 this,它建议安装 MSBuild NuGet 包,但它似乎不是官方的或积极维护的。

是否有可以安装 MSBuild 的官方包源?

【问题讨论】:

    标签: c# .net linux macos msbuild


    【解决方案1】:

    是的,CoreFX team 托管了这样一个包作为 MyGet 提要。要安装,请在终端上运行:

    #!/bin/sh
    
    packageid="Microsoft.Build.Mono.Debug"
    version="14.1.0.0-prerelease" # update as needed
    
    mono path/to/nuget.exe install $packageid -Version \
        $version -Source "https://www.myget.org/F/dotnet-buildtools/"
    
    # run MSBuild
    mono $packageid.$version/lib/MSBuild.exe Foo.sln
    

    从技术上讲,这应该只用于构建 .NET Core 存储库,但我会将它作为非官方发布者的替代品。

    Source.


    编辑:请注意,这仅适用于您的 Mono 版本为 4.0.1 或更高版本。

    【讨论】:

    • 我怎么知道这个包的最新可用(或稳定)版本是什么?它没有在 NuGet.org 上列出
    • 我在 centOS 7 上运行第一个命令时遇到此异常:System.AggregateException: One or more errors occurred. (Could not load file or assembly 'WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.) (Could not load file or assembly 'WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.) ---> System.IO.FileNotFoundException: Could not load file or assembly 'WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
    猜你喜欢
    • 2023-03-08
    • 1970-01-01
    • 2023-04-04
    • 1970-01-01
    • 2017-12-08
    • 2010-11-15
    • 2014-11-29
    • 2011-03-20
    • 2011-04-10
    相关资源
    最近更新 更多