Visual Studio 2015 bower dependencies missing dist/js folder? - asp.net

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?

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..

Using bower with Visual Studio Tools for Apache 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.

What's the right way to use Bower in ASP.Net 5 and VS2015?

I currently try to get myself into ASP.Net 5 development, and I'm struggling to find the "way to go" for using Bower in this.
My project structure looks more or less like this:
testProject
- wwwroot
- index.html
- bower_components (hidden by default in project.json)
- angular
- ...
- ...
- node_components (hidden by default in project.json)
- grunt
- ...
- ...
- bower.json
- Gruntfile.js
- package.json
- project.json
- Startup.cs
I can't access bower_components in index.html and as it's not included in the project by default I guess it's meant this way.
So what's the expected way to work with the bower libraries?
I've seen many people are using grunt-bower-task to install the libraries once again into wwwroot/lib (or some other folder in the wwwroot), but this seems kind of redundant to me as Visual Studio already installs the packages into the project directory.
An alternative would be to use use grunt-copy to move the files from bower_components into the target folder, but with this way you would have to list every library you want to include once again.
So has anyone already gained some experience with this handling and would share how you are doing this?
Hmmm.. Didn't sure I understand the problem right, but anyway, if the problem just in bower destination folder, just add .bowerrc file to your root with content like:
{
"directory" : "wwwroot/lib"
}
and after bower install command, bower will download libs in your dest folder

How To Run MSBuild scripts in .wixproj?

Im trying to learn to make a web installer using Windows Installer XML (WIX 3.5). I found this blog about using msbuild in .wixproj files to avoid the scenario where the installer ends up dropping the web project assemblies right in the root of the app instead of keeping them in the bin folder like they're supposed to be.
Here is the link to that:
<http://www.paraesthesia.com/archive/2010/07/30/how-to-consume-msdeploy-staged-web-site-output-in-a.aspx>
But after adding the MSBuild scripts in the .wixproj file, I don't know what to do anymore. According to the instruction after adding the MSBuild script:
"When that target runs, you'll see a .wxs file pop out in the .wixproj project folder. Add the generated .wxs to your .wixproj project so it knows to include it in the build."
I really don7t know what this means. How can I run the target? I tried to build it but there was no .wxs file generated in the .wixproj folder.
Am I missing something? Please help...
Assuming you have added the section from the tutorial:
<Target Name="BeforeBuild">
...
</Target>
The target will be run automatically when you build the project. The "BeforeBuild" target is one of the standard entry-points to add your own modifications to the build. The target will then generate a file (named [WebProjectName].wxs that is placed in the same directory as your wixproj file. Click on the show all files button in visual studio and right-click on the file and "Include in project" That will then include the wxs is your installer and when you next build it will have the correct folder/file structure.

Resources