it:ad:gulp:howto:integrate_with_visual_studio

IT:AD:gulp:HowTo:Integrate With Visual Studio

Summary

Visual Studio has seen the rise of IT:AD:Grunt and IT:AD:Gulp and has decided to integrate them into Visual Studio and IT:AD:Code.

They've even stopped using IT:AD:Nuget for managing the javascript packages (Bootstrap, IT:AD:Angular because it was pretty obvious that using a Package manager developed specifically for js and css was always going to be better than using for js and css one that was originally designed for .NET…

But of course…you can't marry such disparate bed partners without some hitches.

For one, there's the difference as to where the root package folder (where the package.json file lives).

For a js approach, the root folder is the parent of the app/ folder. Something like:

app/  <-- both the project root and local package root folder
  src/
    controllers/
    css/
    images/
    scripts/
  dist/
    controllers/
    css/
    images/
    scripts/
  package.json  

Whereas in Visual Studio, the package.json file is one deeper

solution/ <-- local package root folder
  app/  <-- both the project root
    src/
      controllers/
      css/
      images/
      scripts/
    dist/
      controllers/
      css/
      images/
      scripts/
  package.json  

Since node.js packages are invariably written for the first scenario…things need sorting out.

Not only is the package.json file's location an issue, but Visual Studio has the same issue with the gulpfile.js – it expects to find it in the project root directory – not the app/ directory.

Turns out that there is a way to get rid of the wwwroot folder (or app folder if you've renamed it) altogether.

The steps are described here and basically involve doing the following:

  • first, you have to set the hosting.json's webroot value to nothing
hosting.json
{
  "webroot": ""
}
  • then you have to actually removing the wwwroot folder, moving all it's contents down to the project root.

For as long as ASP.MVC was around we've been used to serving client side html from some form of server-side project. In other words, our presentation projects were always a mish-mash of server-side controllers and static html, css, and images.

I'm going to recommend that you don't.

Instead, cut a new project for client code only.

  • /home/skysigal/public_html/data/pages/it/ad/gulp/howto/integrate_with_visual_studio.txt
  • Last modified: 2023/11/04 22:58
  • by 127.0.0.1