While following the examples in the Pro ASP.NET Core MVC 2 book I realized that currently it doesn't exist a package manager for JavaScript packages with good integration with Visual Studio.
Prior to version 15.5 a package manager named Bower was integrated with Visual Studio. This support was however removed and the plan is to add support for a new package manager, called Library Manager, or LibMan for short in version 15.8 of Visual Studio. But the current version 15.7.4 have no good integration with any JS package manager.
So, what can you do about it? Well you can use the Node Package Manager, npm. This has some integration with Visual Studio and adding a package.json to the root of your project lets you specify packages that is downloaded for you. But, the downloaded files are not included in your project, instead they are just downloaded to a folder named node_modules in your project directory.
So, how do you add the files you need to your project? Well first of all, be sure to add node_modules/ to your .gitignore if you are using Git. You don't want to be adding all the packages to your repository. Then you can either manually copy the files you want from the node_modules folder into your project. This works fine for small projects that you do on your own at home.
If you want a more automated way you can add the Bundler and Minifier extension to Visual Studio (available through Extensions and Updates) and add a bundleconfig.json file to your project root that specifies which files to copy from the node_modules folder to your project.
If you want to see this done you can take a look at the WorkingWithVisualStudio project on my GitHub area.
Prior to version 15.5 a package manager named Bower was integrated with Visual Studio. This support was however removed and the plan is to add support for a new package manager, called Library Manager, or LibMan for short in version 15.8 of Visual Studio. But the current version 15.7.4 have no good integration with any JS package manager.
So, what can you do about it? Well you can use the Node Package Manager, npm. This has some integration with Visual Studio and adding a package.json to the root of your project lets you specify packages that is downloaded for you. But, the downloaded files are not included in your project, instead they are just downloaded to a folder named node_modules in your project directory.
So, how do you add the files you need to your project? Well first of all, be sure to add node_modules/ to your .gitignore if you are using Git. You don't want to be adding all the packages to your repository. Then you can either manually copy the files you want from the node_modules folder into your project. This works fine for small projects that you do on your own at home.
If you want a more automated way you can add the Bundler and Minifier extension to Visual Studio (available through Extensions and Updates) and add a bundleconfig.json file to your project root that specifies which files to copy from the node_modules folder to your project.
If you want to see this done you can take a look at the WorkingWithVisualStudio project on my GitHub area.
Kommentarer
Skicka en kommentar