如何在 OS X 上使用 mdtool 构建 .sln 文件

How to build a .sln file using mdtool on OS X

我正在尝试在 /SteamBot-master/SteamBot.sln 中编译一个 .sln 文件。 经过研究,我发现我只能在 Xamarin Studio 的 mdtool 目录中使用 mdtool。所以我进入终端的内容如下:

"/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool" -v build SteamBot-master/SteamBot.sln

这是我收到的错误消息:

-bash: /Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool: No such file or directory

mdtool.exec 应用程序在 MacOS 文件中,我已经检查过了。当我尝试 运行 Xamarin Studio 中的应用程序时,出现以下错误:

/Users/Johannes/SteamBot-master/.nuget/NuGet.targets: Error: Command 'bash "/Users/Johannes/SteamBot-master/.nuget/../.ci/exec-with-retry.sh" mono --runtime=v4.0.30319 /Users/Johannes/SteamBot-master/.nuget/NuGet.exe install "packages.config" -source ""  -RequireConsent -solutionDir "/Users/Johannes/SteamBot-master/"' exited with code: 127. (SteamTrade)

如果有人可以帮助我解决此问题以便我可以使用该应用程序,我将不胜感激。非常感谢您,对于我缺乏编程知识,我深表歉意。

编辑:新错误消息

jo-macbook:~ Johannes$ /Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool -v build SteamBot-master/SteamBot.sln
Xamarin Studio Build Tool
Projektmappe /Users/Johannes/SteamBot-master/SteamBot.sln wird geladen
   Projektmappe /Users/Johannes/SteamBot-master/SteamBot.sln wird geladen
      Loading projects ..
Erzeuge Projektmappe: SteamBot (Debug)
   SteamTrade (Debug) wird erzeugt

      Build started 30.08.2015 14:59:16.
      __________________________________________________
      Project "/Users/Johannes/SteamBot-master/SteamTrade/SteamTrade.csproj"
      (Build target(s)):

        Target RestorePackages:
            Executing: bash
      "/Users/Johannes/SteamBot-master/.nuget/../.ci/exec-with-retry.sh" mono
      --runtime=v4.0.30319 /Users/Johannes/SteamBot-master/.nuget/NuGet.exe
      install "packages.config" -source ""  -RequireConsent -solutionDir
      "/Users/Johannes/SteamBot-master/"
            bash: /Users/Johannes/SteamBot-master/.nuget/../.ci/exec-with-retry.sh:
      No such file or directory
      /Users/Johannes/SteamBot-master/.nuget/NuGet.targets: error : Command
      'bash "/Users/Johannes/SteamBot-master/.nuget/../.ci/exec-with-retry.sh"
      mono --runtime=v4.0.30319
      /Users/Johannes/SteamBot-master/.nuget/NuGet.exe install
      "packages.config" -source ""  -RequireConsent -solutionDir
      "/Users/Johannes/SteamBot-master/"' exited with code: 127.
        Task "Exec" execution -- FAILED
        Done building target "RestorePackages" in project
      "/Users/Johannes/SteamBot-master/SteamTrade/SteamTrade.csproj".-- FAILED

      Done building project
      "/Users/Johannes/SteamBot-master/SteamTrade/SteamTrade.csproj".-- FAILED

      Build FAILED.
      Errors:

      /Users/Johannes/SteamBot-master/SteamTrade/SteamTrade.csproj (Build) ->
      /Users/Johannes/SteamBot-master/.nuget/NuGet.targets (RestorePackages
      target) ->

        /Users/Johannes/SteamBot-master/.nuget/NuGet.targets: error : Command
      'bash "/Users/Johannes/SteamBot-master/.nuget/../.ci/exec-with-retry.sh"
      mono --runtime=v4.0.30319
      /Users/Johannes/SteamBot-master/.nuget/NuGet.exe install
      "packages.config" -source ""  -RequireConsent -solutionDir
      "/Users/Johannes/SteamBot-master/"' exited with code: 127.

         0 Warning(s)
         1 Error(s)

      Time Elapsed 00:00:00.1292110
/Users/Johannes/SteamBot-master/.nuget/NuGet.targets : error: Command 'bash "/Users/Johannes/SteamBot-master/.nuget/../.ci/exec-with-retry.sh" mono --runtime=v4.0.30319 /Users/Johannes/SteamBot-master/.nuget/NuGet.exe install "packages.config" -source ""  -RequireConsent -solutionDir "/Users/Johannes/SteamBot-master/"' exited with code: 127.

问题是您已经有效地对 space 进行了两次转义。将带有 spaces 的命令括在双引号内,或者在每个 space 前放置一个反斜杠,但不能同时使用!

使用其中之一:

/Applications/"Xamarin Studio.app"/Contents/MacOS/mdtool ...

/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool ...

我假设您使用的是来自 GitHub:

的 SteamBot 源代码

https://github.com/Jessecar96/SteamBot

缺少 .ci/exec-with-retry.sh 文件,因为这是持续集成构建的一部分,不在 GitHub。

可能最简单的解决方法是编辑 .nuget/NuGet.targets 文件并更改以下行:

<RestoreCommand Condition=" '$(OS)' != 'Windows_NT' ">bash "$(NuGetToolsPath)\..\.ci\exec-with-retry.sh" $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)"  $(RequireConsentSwitch) -solutionDir "$(SolutionDirParsed)"</RestoreCommand>

收件人:

<RestoreCommand Condition=" '$(OS)' != 'Windows_NT' ">$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)"  $(RequireConsentSwitch) -solutionDir "$(SolutionDirParsed)"</RestoreCommand>

这只是删除了对文件和 bash 的引用。