CSS intellisense not working after migrating MVC 5 Project to Bower - asp.net-mvc

I've just switched a project over to using Bower and I now have blue squigglies under all the CSS classes from bower packages in my views:
I'm guessing this is because intellisense isn't finding the CSS files?
I've set Bower up to put all the files it downloads in a folder called lib at the root of my web project, that lib folder isn't included in the project in VS:
I don't really want to add that folder as it will contain thousands of files and make the proj file huge I imagine (I did try adding it, but VS just went unresponsive).
The Bower CSS files are being loaded into the project using the MVC bundler:
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/lib/bootstrap/dist/css/bootstrap.*",
"~/lib/font-awesome/css/font-awesome.*",
"~/lib/AdminLTE/dist/css/AdminLTE.*",
"~/lib/AdminLTE/dist/css/skins/skin-blue-light.*",
"~/lib/AdminLTE/dist/css/skins/skin-green-light.*",
"~/Content/site.css"));
I'm using ReSharper, but switching it to use VS's Intellisense doesn't make any difference. Dave Paquette seems to have identified a similar issue in VS2013, is this just the expected behaviour with Bower?

Related

bower.json and .bowerrc missing from ASP .NET MVC template

While the Visual Studio and Visual Studio Code MVC templates comes with some client packages such as jQuery, jQueryValidation, bootstrap etc. the bower.json and .bowerrc files are completely missing, so when I go into the VS bower package manager I don't see the already installed packages which is quite annoying.
The thing is this started happening to me 2 weeks ago( around the time I tried npm package manager and did a VS Code update), how can I re-enable bower appearing with the MVC template?
This might be related to bower being deprecated. Those libraries in the template are no longer managed by bower thus they don't show in the manager. If you manually add the bower.json and .bowerrrc files you might be able to continue using bower for js library dependency management. First delete the local copies of the js files that were not added by bower, then re-add them using bower.
However, bower recommends using yarn for js library dependency management. For the client packages jquery, jquery-validation, and bootstrap you could use yarn, npm, or local copies. But for large common libraries like jquery you may want to include from Google's CDN https://developers.google.com/speed/libraries/#jquery

Upgraded to Bootstrap 4 - still serving Bootstrap v3 in ASP.Net MVC 5 project

I have Boostrap v4 script files installed in my project ~/Content and ~/Script folders, but when run my project uses Boostrap v3! Why, and how to force it to use v4?
It is an MVC 5 project contained in a solution with a UWP project. I have upgraded the MVC project to Bootstrap v4, which has updated all of the Bootstrap files to v4. I'm not using a CSS preprocessor. My BundleConfig.cs is unchanged, and seems to load whatever version is found in the ~/Scripts folder:
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
But when run, if I interogate the HTML then the bootstrap file served is v3:
When run, Visual Studio generates a temporary "Script Documents" folder underneath the parent solution for displaying "client-side script files generated from server-side scripts" - and the Bootstrap file loaded here is v3:
I noticed that the upgrade to v4 did not download updated versions of the boostrap-theme.css/.css.map/.min/.min.css.map files - but pages and elements load fine with these files removed from the project so I think its unrelated.
After updating the Bootstrap script files to v4, what other configurations are required for ASP.Net MVC to load Bootstrap v4 script files from it's project ~/Content and ~/Script files?
Clearing the browser cache did it for me

How do I include libraries that installed via NPM to my MVC project on Visual Studio 2017

I am trying to move from Bower to NPM.
While I was using Bower, it was easy to configure the .bowerrc file and have the downloaded libraries in a directory such as wwwroot/lib
Now, I am developing a ASP.Net Core MVC app and trying to use NPM as my default package manager. By using Command Line in Visual Studio 2017, NPM creates package.json file and download libraries to node_modules folder. Then, what is next? How can I get JS or CSS files like I used to have in wwwroot/lib director?
Ok, so heres' the thing.
NPM: Node JS package manager, helps you to manage all the libraries your software relays on. You would define your needs in a file called package.json and run npm install in the command line... BANG your packages are downloaded and are ready to use. Could be used both for front-end and back-end.
resource: https://www.quora.com/What-are-the-differences-between-NPM-Bower-Grunt-Gulp-Webpack-Browserify-Slush-Yeoman-and-Express
Now, here's where NPM stops and his dear friend Gulp takes over. I can't type all of it, but to have your css and js files in a folder (and do whatever you want with them) you'll have to use an automation tool (I personally use Gulp but there's a bunch of them out there).
It's easy to set up and the documentation is here:
https://gulpjs.com/
Gulp will basically be responsible of how and where your css files get compiled. It will base its requests for packages in the node_modules folder. So you're good to go. Configure gulp and you should be on your way.
There's also webpack. Never used it, but it seems to be the future of automation:
https://webpack.js.org/
I'd suggest using webpack.

ASP.NET MVC Bundles not picking latest updated scripts

I am trying to use bundles for registering scripts in my project.
I notice that the runtime isn't picking updated scripts into the bundle collection.
Is there some settings to be made for the bundles so that files are minified as changes are made to existing files ?

Umbraco: How do I include the generated files after install?

I have installed Umbraco via nuget to empty project. I then ran the project so the installation started.
After installation ran there was lots of generated files so I have included them in project so that I can use source control.
I then ran project again and got the error:
Could not load file or assembly 'Newtonsoft.Json'
There is the dll file for this in bin folder and also a reference.
I think this might be because the "packages" folder created by nuget installation is not included in project. I do not know how to include this.
Does anyone know what I should do?
It turns out problem was in the Newtonsoft.Json file in nuget package. I downloaded latest dll from codeplex and it fixed the problem.

Resources