Using bower with Visual Studio Tools for Apache Cordova - visual-studio-cordova

When I create a blank Apache Cordova app, I got a directory structure like:
root
www
bower.json
...
From the project root directory, if I run "bower install ionic --save", the bower dependencies were all created in the project root while I expect them to go to www.
What is the best way use bower with VSTAC projects?

You can create a .bowerrc file at the root that has the key directory:'www/bower_components' set, indicating that the files are placed inside www instead of the root.
Visual Studio should be able to now download the dependencies inside the www folder.
Note that VS2015 also has intellisense when editing bower.json and automatically installs the dependencies too !!

Use the following command:
npm install -g "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\ApacheCordovaTools\Packages\vs-tac"
It worked perfect for me.

Related

Sharing .netcore project between windows and linux Keeps adding files

I am working on a group project and we have decided to use netcore for the project. The project was originally created using VS.
When I pull the project and run it using VSCode, I have noticed two things:
I have to navigate to the src folder and run it from there.
Before pushing new changes to the master branch, .netcore on linux has made changes to obj folder and added .vscode folder.
how can I stop this from happening so we don't step over each others toes, and why does this happen?
Thanks.
You should not add the files under obj to source control. It contains artifacts that are regenerated on every build.
If you use git, here's a suggested list of files and folders to ignore:
[Oo]bj/
[Bb]in/
.vs/
*.xap
*.user
/TestResults
*.vspscc
*.vssscc
*.suo
*.cache
*.docstates
_ReSharper.*
*.csproj.user
*[Rr]e[Ss]harper.user
_ReSharper.*/
packages/*
artifacts/*
msbuild.log
PublishProfiles/
*.psess
*.vsp
*.pidb
*.userprefs
*DS_Store
*.ncrunchsolution
*.log
*.vspx
/.symbols
nuget.exe
build/
*net45.csproj
*k10.csproj
App_Data/
bower_components
node_modules
*.sln.ide
*.ng.ts
*.sln.ide
project.lock.json
.build/
.testpublish/
launchSettings.json

Bower ASP.NET Core MVC missing jquery.validate.js file

UPDATE:
Visual Studio - File - New - Project
- ASP.NET Core Web Application (.NET Core) - Web Application
I left the default name WebApplication1
expand the wwwroot folder
expand up to wwwroot/lib/jquery-validation
in the jquery-validation folder we can see this (see img below)
- right click the WebApplication1 project in the src folder
- click on Manage Bower Packages
- Bower Package Manager screen asking to update jquery and jquery-validation (see img below)
clicked Update jquery
**everything looks normal (see img below)
clicked Update jquery-validation
dist folder has disappeared (see img below)
The text below is before I UPDATED this Q
I created an empty ASP.NET Core MVC web application in VS2015CE.
I added the bower.json file, that manages client-side stuff of the app.
Via Bower I downloaded jquery, jquery-validate, jquery-validate-unobtrusive.
Bower created a lib folder in the wwwroot folder.
Somewhere in the ~/lib/jquery-validate/ I should be able to find jquery.validate.js and it's "child" - the jquery.validate.min.js
There were no such files there, so I became suspicious and I created another project, this time a NOT empty web application.
I then compared both jquery-validate folders in the lib folders of the two applications.
My first project (created as EMPTY) has the following folder
structure:
dist folder is not present
My second project (created as WebApplication, NOT empty) has the
following folder structure:
dist folder is present and inside it there's the jquery.validate.js file and also it's child, the jquery.validate.min.js file.
What am I doing wrong? Or is it a bug in VS2015? Or a Bower bug?
You need to run the Grunt file which will build the dist folder for you. The best way I've found to do this right now is to install the Grunt Launcher extension. You can then right click on the package.json file within the jQuery-validation folder and select "NPM Install". That should build the dist folder for you.
I haven't found a way to automate this yet, but I'm sure there is. Just started using Gulp and wasn't using Grunt until I ran into the problem you're having. If someone has some tips there, that would be great. Good luck!
Right click on Bower.json file and select Open Command Line ==> PowerSell
type bower update
That's how I resolved my problem..
If Bower doesn't restore the correct packages:
delete everything from the directory value specified in .bowerrc which is located into your web project folder (e.g. wwwroot/lib)
open Git Bash (Git SCM for Windows -> when installing, choose Git Bash option)
go to your web project folder (where bower.json is located)
run the following:
bower cache clean
bower install
OR
bower update
Below it's an example of bower.json file:
{
"name": "asp.net",
"private": true,
"dependencies": {
"bootstrap": "3.3.7",
"jquery": "2.2.0",
"jquery-validation": "1.14.0",
"jquery-validation-unobtrusive": "3.2.6"
}
}
Unfortunately, none of the above offered solutions worked for me.
The problem was solved by smart people at Microsoft with a VS update or by those working on open source stuff.
Must have been a bug or something.
Anyway, thanks for the help guys..

dnu publish does not deploy all image and JavaScript files

I use the following command to deploy an ASP.Net core 1.0 MVC application.
dnu publish --runtime active --no-source -o e:\website\zigs
Issue: Some image files and JavaScript files in the VS2015 project
wwwroot 'images' and 'js' folders are not deployed to the
'e:\website\zigs\wwwroot\' images and ..js sub-folders.
The missing files are present in the VS2015 project and all works correctly in the development environment.
I currently use dnvm version 1.0.0-rct1-15540 and dnx-clr-win-x86.1.0.0-rc1-update2
Is there something I need to do to flag the files to be included in the deployment?
(I can get around it by just manually deploying the missing files, but I would need to have the files deployed automatically by the build/deployment server in the future.)
Thank you.
Solved! Make sure the target root folder does not contain any folders/files to do with the deployment before running the dnu publish command!

Visual Studio 2015 bower dependencies missing dist/js folder?

note sure if this is a bug in Visual Studio 2015 but I thought I'd ask the community to see if anyone else has experienced this odd behaviour.
Steps to reproduce;
Create a new AspNet5 Empty Website.
Add bower config file
Alter the .bowerrc directory to "bower_components"
Add bootstrap ~3.3.6 as a dependency to the bower.json file
right click the bower.json and select "Restore Packages"
Take a look in the bower_components/bootstrap/dist folder and you will see that there is no js folder.
Now, open up Package Manager Console and type "bower install bootstrap"
This creates another bower_components folder in the root of the solution folder with the same folder structure as the one in the web app with one exception, the INCLUSION of the javascript files??
Has anyone else seen this, am I missing something fundamental about bower?

Change default location of node_modules in new ASP.NET5 project structure?

I am planning to use npm to manage all my JavaScript dependencies and get rid of bower from my ASP.NET5 project. I need npm to create node_modules folder in wwwroot location rather than its default location. I tried using .npmrc but VS2015 don't recognize it. Is there a way configure this?

Resources