31

I would like to use Sublime Text 2 to build my Visual Studio 2010 solutions.

So far I have this:

Menu item Tools > Build System > New Build System...

{
    "cmd": ["c:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe"]
}

I get this error:

MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.

I'm wondering how I specify a project folder directory in the build file.

David Silva Smith
  • 11,498
  • 11
  • 67
  • 91

4 Answers4

32

I got it to work by modifying the build system file C:\Users\dave\AppData\Roaming\Sublime Text 2\Packages\User\msbuild.sublime-build like this:

{
    "cmd": ["c:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe"],
    "working_dir": "${project_path:${folder:${file_path}}}"
}

I looked at an existing build configuration that shipped with Sublime to figure it out:

C:\Users\myUser\AppData\Roaming\Sublime Text 2\Packages\Makefile\Make.sublime-build

David Silva Smith
  • 11,498
  • 11
  • 67
  • 91
11

There is now a full MSBuild package for Sublime Text 2 that includes syntax highlighting and completion in addition to build system integration. You can install it using Package Control or directly from https://github.com/tillig/SublimeMSBuild.

Tim Danner
  • 630
  • 8
  • 20
7

Here is reference to all features of Sublime's Build System.

Haris Krajina
  • 14,824
  • 12
  • 64
  • 81
1

The error message is because you did not specify what you wanted to build. See the MSBuild Command Line Reference. At the very least you need to specify a project file:

MSBuild MySolution.sln
MSBuild MyProject.csproj
MSBUild MyMSBuildScript.proj
BryanJ
  • 8,485
  • 1
  • 42
  • 61
  • Bryan, thanks for the answer. msbuild will build a solution or project if there is only one in the folder msbuild is invoked from. I got it to work as described in my answer. – David Silva Smith Mar 10 '12 at 22:07