• Advanced Basics: Using Task Runner in Visual Studio 2019


    Failed to run "C:workspaceCompanyFinland owdevelopSourceEdenredFi.WOTWebGulpfile.js"...
    cmd.exe /c gulp --tasks-simple
    'gulp' is not recognized as an internal or external command,
    operable program or batch file.

    Advanced Basics: Using Task Runner in Visual Studio 2019

    If the world is running on JavaScript, why not automate your client-side tasks through Visual Studio's Task Runner?

    With JavaScript as currently the primary language for developers, it made sense when Microsoft released Visual Studio 2019 to include client-side tools to simplify the JavaScript development process.

    One of those tools was a Task Runner. 

    When the Task Runner was introduced, developers of the C# community never even knew what it was or how it worked (including me).

    Now, since I've dug into it, it proves it's another great tool in the DevOps toolbelt.

    What is a Task Runner

    A Task Runner is a tool to automate repetitive client-side tasks.

    The tool runs off of a configuration file (either Gulp or Grunt) to execute on any number of static assets in a directory.

    For this post, we'll focus on using Gulp with a gulpfile.js.

    Setting up the Task Runner

    In Visual Studio 2019, confirm you are running the latest Node version.

    1. Download the latest version of Node and install it normally.
    2. In Visual Studio, go to Tools, Options.
    3. Expand the Projects and Solutions, Web Package Management, then External Web Tools.
    4. Confirm $(PATH) is at the top of your "location of external tools"

    If you installed NodeJs properly, it will be in your system path. The $(PATH) will point to that when a build process occurs.

    Next, since a Task Runner uses Node for it's engine, we need a populated package.json file to hold the installed packages used in our Task Runner.

    For starters, let's install our Gulp package.

    1. Open the Package Manager Console (View / Windows / Package Manager Console)
    2. Change into the directory containing the root of your solution.
    3. Type: npm install -g gulp

    Examine the package.json file in the directory. It should contain a gulp entry:

    "gulp""^4.0.2"

    Once we have our package installed, we can use it in our test.

    Task runner explorer可以在View-->Other windows中找到。

  • 相关阅读:
    POJ 2528 Mayor's posters 线段树+离散化
    Leveldb之version与version_set详细对比
    rocksdb编译测试的正确姿势
    ycsb使用方法
    memalign vs malloc
    四种监听器(自身类,外部类,内部类,匿名类)
    数据库基础
    哈希索引和Btree索引
    哈希表hashtable
    抽象类和接口
  • 原文地址:https://www.cnblogs.com/chucklu/p/15132582.html
Copyright © 2020-2023  润新知