vmariano
vmariano

Reputation: 493

Using bower in visual studio without gulp/grunt

I'm triying to make a mvc5 project with global dependencies. I just found I can use bower with nuget package manager: How to use Bower (installed from nuget) in Visual Studio?

But I can´t make it work in the build process, and the whole documentation i found are examples with grunt/gulp.

In the major documentation of this project is inactive, because vs 2015 is going to make an official support (I have 2013).

Is possible run bower without grunt/gulp?

Is possible to resolve bower dependencies in a build action?

Upvotes: 0

Views: 239

Answers (1)

Liviu Costea
Liviu Costea

Reputation: 3794

Yes, you can use bower without grunt and have the visual studio/TFS build do the packages installation. After you install npm and bower, you create your bower.json file in your web application by running in the command line (don't add it from visual studio because there is a problem with the default encoding)

bower init


and then add the newly created bower.json to your project files. Then you edit your csproj and add the following lines:

<Target Name="BeforeBuild">
   <Exec Command="bower install" />
</Target>

This command will create, if needed, at every build, the folder bower_components, you just need to make sure every development machine has bower installed including the build machine. And you will be able to reference all needed files from bower_components (and make sure you don't deploy the whole folder).

Upvotes: 1

Related Questions