I'm trying to use msbuild with my sublime project. I created the build file suggested here and the following is my project file
{
"folders":
[
{
"path": "/W/MyOrg/MyApp",
"folder_exclude_patterns": ["_ReSharper.*", "bin", "obj"]
}
]
}
I select the msbuild40 build system and hit Build and get the output:
[Error 6] The handle is invalid
[Finished]
I'm not even sure if this is a python or an msbuild error. Which is it, how can I fix it, and whats a good way to troubleshoot this sort of stuff in the future?
Update
I tried updating my project to the following and using that build and still no dice
{
"folders":
[
{
"path": "/W/MyOrg/MyApp",
"folder_exclude_patterns": ["_ReSharper.*", "bin", "obj"]
}
],
"build_systems":
[
{
"name": "msbuild",
"cmd": ["c:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe", "w:\\MyOrg\\MyApp\\MyApp.sln"]
}
]
}
Turns out that this happens whenever you start sublime from command line ( I was starting it via a powershell alias).
You can fix this by using a batch file and the START command. I created sublime_text.bat:
START "Sublime Text 2" "C:\Program Files\Sublime Text 2\sublime_text.exe" %*
and set my powershell alias to that bat file. Now everything works.
Related
I’m using «PlantUML» extension, and I want to export diagram automatically on file save. For this purpose I found «Trigger Task on Save» extension and tried write task that will execute command «command:plantuml.exportCurrent» on save of any .puml file.
settings.json (for «Trigger Task on Save» extension)
{
"triggerTaskOnSave.on": true,
"triggerTaskOnSave.restart": true,
"triggerTaskOnSave.tasks": {
"Export current diagram to SVG": [
"*.puml"
]
},
}
tasks.json
{
"version": "2.0.0",
"cwd": "${workspaceFolder}",
"tasks": [
{
"label": "Export current diagram to SVG",
"command": "${command:plantuml.exportCurrent}",
}
],
}
This export command requires from user to select file format (file format select options). I need to export diagram in svg format. Is it possible to automatically select «svg» option in task?
It should be possible if you set (in the PlantUML extension) your export format to SVG (so it won't ask you the format when you export):
I want to setup tern-vim in my project and followed this link https://github.com/ternjs/tern_for_vim/blob/master/doc/tern.txt.
After installation, I created a .tern-project file under the root directory of my project as below.
{
"libs": [
"browser",
"jquery"
],
"loadEagerly": [
"importantfile.js"
],
"plugins": {
"requirejs": {
"baseURL": "./",
"paths": {}
}
}
}
When I open a js file by vim command, I can't use any tern command as below:
|:TernDoc|...................... Look up Documentation
|:TernDocBrowse|................ Browse the Documentation
|:TernType|..................... Perform a type look up
|:TernDef|...................... Look up definition
|:TernDefPreview|............... Look up definition in preview
|:TernDefSplit|................. Look up definition in new split
|:TernDefTab|................... Look up definition in new tab
|:TernRefs|..................... Look up references
|:TernRename|................... Rename identifier
I will get Not an editor command error. Do I need to do any other configuration?
I'm trying to setup a clojurescript project that uses the lein-less plugin to compile .less files. I should say I'm new to clojurescript. The problem is that it doesn't seem to run. It doesn't run when I run "lein figwheel" and neither when I change a .less file.
This is my project.cljs
(defproject fed-repo "0.1.0"
:description "Frontend Repository"
:dependencies [
[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.170"]
[org.omcljs/om "1.0.0-alpha22"]
]
:plugins [
[lein-less "1.7.5"]
[lein-cljsbuild "1.1.2"]
[lein-figwheel "0.5.0-4"]
]
:less {
:source-paths ["src"]
:target-path "resources/public/css"
}
:hooks [
leiningen.less
leiningen.cljsbuild
]
:cljsbuild {
:builds [
{
:id "dev"
:source-paths ["src"]
:figwheel true
:compiler {
:main "fed-repo.core"
:asset-path "js/out"
:output-to "resources/public/js/main.js"
:output-dir "resources/public/js/out"
}
}
]
}
)
What is wrong with this setup?
Under :less the values for the keys :source-paths and :target-path need to go to actual files. You seem to have stopped at the directory.
Here's a working example:
:less {:source-paths ["src/less/"]
:target-path "resources/public/css/"}
Another issue is that you are not telling Figwheel where to hot code reload css from. Example:
:figwheel { :css-dirs ["resources/public/css"] }
With the set up so far there is still no .less -> .css file generation. You could have a terminal open that is dedicated to running lein less once. After changing the .less file run that command. Alternatively automatic generation can be done with the command lein less auto.
In Visual Studio Code (VSCode) I've create a task to build my c++ project. The build-process is based on Visual-Studio 12.0 projects files create by CMake. It provides configurations for Release/Debug/... modes and I want to create for each configuration a separate task.
Problem: VSCode appends the taskName to msbuild automatically. My tasks.json file looks like:
{
"version": "0.1.0",
"command": "msbuild",
"args": ["${cwd}/build/PROJECTNAME.sln",
"/property:GenerateFullPaths=true"],
"taskSelector": "/t:",
"tasks": [
{
"taskName": "build release",
"args": ["/p:Configuration=Release"],
"problemMatcher": "$msCompile"
},
{
"taskName": "build debug",
"args": ["/p:Configuration=Debug"],
"problemMatcher": "$msCompile"
}]
}
The argument /t:${taskName} seems to be appended automatically to msbuild. If I add the parameter /t:Build in the args variable of a task manually, It gives me the error, that two targets are specified in msbuild. Removing the taskSelector variable does not help. The only way I get it running, is to set all taskName variables to Build, but then I can not distiguish between different tasks in the tasks-selector.
Any ideas how to solve this?
PS: is there a reference of possible parameters for the tasks.json file, except those provided in the example file and on the official documentation site?
We have a work item to support suppressTaskName on the task description. If this does get implemented would it solve your problem.
After playing around with msbuild command-line arguments I've figured out a workaround. It is not nice and only works in some cases, but for me it is fine. Hopefully in later versions of VSCode a better solution can be implemented.
The idea: Add a dummy argument to msbuild, that has no meaningful effect. I've tried two version: (1) add the preprocess command-line switch, that creates a file with content that you could ignore, i.e. "taskSelect": "/pp:"; (2) add a dummy property to msbuild that accepts any argument, like /p:DefineConstants=....
The final tasks.json file looks like:
{
"version": "0.1.0",
"command": "msbuild",
"args": ["${cwd}/build/PROJECTNAME.sln",
"/property:GenerateFullPaths=true"],
// a dummy taskSelector to overcome a restriction in msbuild
// (1) "taskSelector": "/pp:",
// (2) ...
"taskSelector": "/p:DefineConstants=taskName_",
"tasks": [
{
"taskName": "build_release",
"args": ["/t:Build", "/p:Configuration=Release"],
"problemMatcher": "$msCompile"
},
{
"taskName": "build_debug",
"args": ["/t:Build", "/p:Configuration=Debug"],
"problemMatcher": "$msCompile"
}
]}
You can only use taskName without spaces, but this is ok, since one can now distinguish between different tasks.
Maybe in other build-systems like grunt there is a similar dummy-parameter that can be set to taskName without changing the build-process.
I'm open to better solutions to this problem.
I'm new to Grunt (and fairly new to sublime Text), but I've downloaded the excellent grunt build system and it works well every time I save. I'm on Win8 by the way.
The only problem is that it runs all tasks/targets. I have separated my tasks into "dist" and "dev" targets and I would like it to run only the dev tasks when I use it on save.
I'd then like to create a separate build task which I would use when building for production. Is this a sensible strategy?
Anyway, I just need to know how to modify the following build system file to just run tasks with the "dev" target....
{
"cmd": ["grunt", "--no-color"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${project_path:${folder:${file_path}}}",
"selector": "Gruntfile.js",
"windows":
{
"cmd": ["grunt.cmd", "--no-color"]
},
"variants":
[
{
"name": "Gruntfile",
"cmd": ["grunt", "--no-color"],
"windows":
{
"cmd": ["grunt.cmd", "--no-color"]
}
}
]
}
You first need to create an task that runs all the dev targets:
grunt.registerTask('dev', ['task:dev', 'task2:dev']);
This can be run from the command-line using: grunt dev
As for the Sublime build config, "cmd" is just an array of command-line arguments.
So it would end up like this:
{
"cmd": ["grunt", "dev", "--no-color"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${project_path:${folder:${file_path}}}",
"selector": "Gruntfile.js",
"windows":
{
"cmd": ["grunt.cmd", "dev", "--no-color"]
},
"variants":
[
{
"name": "Gruntfile",
"cmd": ["grunt", "dev", "--no-color"],
"windows":
{
"cmd": ["grunt.cmd", "dev", "--no-color"]
}
}
]
}
All you need to do is call Grunt by specifying it's complete path. Calling grunt alone fails, even though you have the grunt-cli installed and working from the cmd prompt. Note you need to have the environment variable for nodejs set.
Windows users create your my-project.sublime-builder file and put it in C:\Users\yourname\AppData\Roaming\Sublime Text\Packages\User. Apple/Unix location will be different.
The my-project.sublime-builder file looks like:
{
"cmd": "C:\\Users\\ronni\\AppData\\Roaming\\npm\\grunt.cmd",
"working_dir": "C:\\Users\\ronni\\documents\\my-project"
}