How can I set up gulp to run identically in Visual Studio 2017 and msbuild without having to change my build scripts?

后端 未结 3 1988
礼貌的吻别
礼貌的吻别 2021-02-06 00:18

I\'m struggling to get set up with gulp in Visual Studio 2017. I\'m not sure where I\'m going wrong but there are a few things I\'m confused about and I can\'t really find any o

3条回答
  •  鱼传尺愫
    2021-02-06 00:33

    Microsoft have now added documentation on how to get gulp running: https://docs.microsoft.com/en-us/aspnet/core/client-side/using-gulp

    Make sure you update Visual Studio 2017 to the latest version as it now comes shipped with Node.js, NPM and Gulp (you don't need to pick "Node.js support" when installing Visual Studio for this to work).

    Create an npm Configuration File (package.json) in your project folder and edit it to reference gulp:

    {
      "version": "1.0.0",
      "name": "example",
      "private": true,
      "devDependencies": {
        "gulp": "3.9.1"
      },
      "scripts": {
        "gulp": "gulp"
      }
    }
    

    In the project folder, create a Gulp Configuration File (gulpfile.js) to define the automated process.

    Add the following to the post-build event command line for each project requiring gulp support:

    cd $(ProjectDir)
    call dotnet restore
    npm run gulp
    

    To run the tasks in Visual Studio 2017, open the Task Runner Explorer (View > Other Windows > Task Runner Explorer).

    Then on the build server just install Node.js and ensure the path to node is added to the environmental path variable then when the build server builds the project gulp will run too!

提交回复
热议问题