使用typescript的asp.net核心项目的任务设置
我有一个asp.net核心应用程序,带有typescript和angular2,正在VS2015中开发。 我正在尝试将其移动到vscode。 我用dotnet命令创建了一个新项目,并开始设置依赖项、工具等。 我设置了调试.net核心应用程序的任务(它是由vs代码创建的) 现在,我正在研究如何在监视模式下设置building typescript并运行gulp任务。 VS代码在前面为我提供了为TS创建命令的功能,但据我所知,只能有一个命令!那么,如何让asp.core应用程序以最正确的方式在vscode中运行调试、TS编译、tslint处理和gulp任务,并从所有这些工具输出到vscode typescript的任务:使用typescript的asp.net核心项目的任务设置,typescript,angular,asp.net-core,visual-studio-code,asp.net-core-1.0,Typescript,Angular,Asp.net Core,Visual Studio Code,Asp.net Core 1.0,我有一个asp.net核心应用程序,带有typescript和angular2,正在VS2015中开发。 我正在尝试将其移动到vscode。 我用dotnet命令创建了一个新项目,并开始设置依赖项、工具等。 我设置了调试.net核心应用程序的任务(它是由vs代码创建的) 现在,我正在研究如何在监视模式下设置building typescript并运行gulp任务。 VS代码在前面为我提供了为TS创建命令的功能,但据我所知,只能有一个命令!那么,如何让asp.core应用程序以最正确的方式在vsc
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"args": ["-w", "-p", "."],
"showOutput": "silent",
"isWatching": true,
"problemMatcher": "$tsc-watch"
}
dotnet的任务:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"args": [ ],
"isBuildCommand": true,
"showOutput": "silent",
"problemMatcher": "$msCompile"
}
]
}
因为您需要同时运行多个任务。我建议您研究npm脚本 npm允许您在packages.config文件中创建命令。下面是我在项目中使用的一个示例。查看“start”命令。它将使用一个名为“并发”的包同时运行多个命令。在本例中,它运行tsc:w,该命令在下面的另一个命令中定义,运行lite server,并运行my gulp任务 我在VSCode中点击debug,在VSCode终端(CTRL+~)中点击并运行npm start,现在就可以开始了 packages.config
{
"name": "queuedodge-site",
"description": "web front end for queue dodge.",
"private": true,
"scripts": {
"install": "tsc && gulp sass && gulp bundle",
"start": "concurrently \"npm run tsc:w\" \"npm run lite\" \"gulp default\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings",
"bundle": "gulp default"
},
"dependencies": {
"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "2.0.0-rc.1",
"@angular/core": "2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"@angular/platform-browser": "2.0.0-rc.1",
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
"@angular/router": "2.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.1",
"@angular/upgrade": "2.0.0-rc.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"systemjs": "^0.19.27",
"zone.js": "^0.6.12",
"bootstrap": "3.3.6",
"es6-promise": "3.1.2",
"es6-shim": "^0.35.0",
"jquery": "2.2.0"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typings": "1.0.4",
"systemjs-builder": "0.15.16",
"typescript": "^1.8.10",
"gulp": "3.9.1",
"gulp-sass": "2.2.0",
"gulp-markdown": "1.2.0",
"tslint": "3.5.0",
"yargs": "4.7.0"
}
}
因为您需要同时运行多个任务。我建议您研究npm脚本 npm允许您在packages.config文件中创建命令。下面是我在项目中使用的一个示例。查看“start”命令。它将使用一个名为“并发”的包同时运行多个命令。在本例中,它运行tsc:w,该命令在下面的另一个命令中定义,运行lite server,并运行my gulp任务 我在VSCode中点击debug,在VSCode终端(CTRL+~)中点击并运行npm start,现在就可以开始了 packages.config
{
"name": "queuedodge-site",
"description": "web front end for queue dodge.",
"private": true,
"scripts": {
"install": "tsc && gulp sass && gulp bundle",
"start": "concurrently \"npm run tsc:w\" \"npm run lite\" \"gulp default\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings",
"bundle": "gulp default"
},
"dependencies": {
"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "2.0.0-rc.1",
"@angular/core": "2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"@angular/platform-browser": "2.0.0-rc.1",
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
"@angular/router": "2.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.1",
"@angular/upgrade": "2.0.0-rc.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"systemjs": "^0.19.27",
"zone.js": "^0.6.12",
"bootstrap": "3.3.6",
"es6-promise": "3.1.2",
"es6-shim": "^0.35.0",
"jquery": "2.2.0"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typings": "1.0.4",
"systemjs-builder": "0.15.16",
"typescript": "^1.8.10",
"gulp": "3.9.1",
"gulp-sass": "2.2.0",
"gulp-markdown": "1.2.0",
"tslint": "3.5.0",
"yargs": "4.7.0"
}
}
您还应该添加[asp.net core]标记。这样,当有人搜索asp.net core时,您的问题就会显示出来。仅使用[asp.net-core-1.0]标记,您的问题仅在人们在搜索中包含1.0时显示。您还应添加[asp.net core]标记。这样,当有人搜索asp.net core时,您的问题就会显示出来。仅使用[asp.net-core-1.0]标记,只有当人们在搜索中包含1.0时,才会显示您的问题。好的,这是可能的。但看起来并不是最好的选择。我也在寻找同样的东西,同时也试图避免节点/npm,因为这会挫败让dotnet为项目服务的目的。最后我决定用webpack做服务/编译/打包。。。还有其他的东西。类似于:然后从VS代码命令PalletOK运行任务,这是可能的。但看起来并不是最好的选择。我也在寻找同样的东西,同时也试图避免节点/npm,因为这会挫败让dotnet为项目服务的目的。最后我决定用webpack做服务/编译/打包。。。还有其他的东西。类似于:然后从VS代码命令pallete运行任务