首页 > 解决方案 > Visual Studio Mac,从命令行构建?

问题描述

我正在考虑使用 Visual Studio 和 Xamarin 来构建跨平台应用程序,但我更喜欢使用 Sublime Text 作为我的编辑器。目前我找不到任何关于 3rd 方工具与 Visual Studio 集成的信息。

Visual Studio 是否可以像 Xcode 那样使用“xcodebuild”实用程序从命令行构建?理想情况下,我想制作一个 shell 脚本,它可以像我在 VS 中按下构建按钮一样构建,并返回我可以在 Sublime Text 中解析和显示的错误。

非常感谢任何建议。

标签: macosvisual-studiosublimetext3

解决方案


我以这种方式使用位于“/Applications/Visual Studio.app/Contents/MacOS/vstool”的“vstool”:

vstool build -t:Build -c:"Release|iPhone" "MyProject.sln";

如 vstool 帮助中所述:

Visual Studio Build Tool
build [options] [build-file]
-p --project:PROJECT  Name of the project to build.
-t --target:TARGET    Name of the target: Build or Clean.
-c --configuration:CONFIGURATION  Name of the solution configuration to build.
-r --runtime:PREFIX   Prefix of the Mono runtime to build against.

Supported targets:
  Build: build the project (the default target).
  Clean: clean the project.

推荐阅读