Bootstrap update only working on Debug configuration (Visual Studio) - asp.net

So I recently update from bootstrap 2 to bootstrap 4. I then changed the syntax, grids and such. The website was running/building fine in debug, however, when it comes to release, it won't work. It can build without errors, but when I run it, it seems like the site has the new syntax and classes (the code running is the one i changed) but bootstrap is still at v.2. I checked multiple times, there are no bootstrap 2 files left, nor any cdn references. I can see it still is running bootstrap 2 by changing classes from col-12 to, say span12. It works fine in debug, but not in release. Any clue why ?
Also, the site is running Asp.NET Core MVC Razor.

I think you might have a bundle-ing configuration issue.
Please verify your bundle configuration (App_Start\BundleConfig.cs) and the web.config settings and pertinent web.config transform.
You can find documentation on how to configure your bundles here : Bundling and Minification (assuming you're not using ASP.NET Core)
For ASP.NET Core it a bit more complicated because you can have multiple ways of doing the budleing. Documentation for it can be found here: Bundle and minifiy static assets in ASP.NET Core.
However, I think that is pretty probable that the production version of your app is still targeting the old Bootstrap version because of the bundle-ing configuration

Related

DotNet - MVC: Testing for validating css minification

I need to test that all CSS/SCSS files in a project have been successfully minified in the build process of a .Net MVC App, or at least test that they are valid CSS.
Currently, the project is built in VSO/VSTS, and syntax errors in the CSS will not fail the build, and the app is deployed with broken CSS.
I know very little about .Net apps, I know that the main project is ProjectName.Web, the tests are ProjectName.Web.Test, and if I want to test something, I create a corresponding "-Test" class in the ".Test" project, but where would I put a test for minification of files? The files are bundled in ProjectName.Web/App_Data/BundleConfig, and use BundleTransformer to minify the files, how do I check it worked correctly after build?
Any pointers are welcome!
Here is a link to de-minify css. I would recommend you de-minify it, identify the problems, then minify it again. Usually they are small things. If you can post the deminified code then I would be happy to help.

asp.net MVC Bootstrap, replacing the .min.css file

This should work and I have no clue why it doesn't, literally all I am doing is creating a new ASP.NET MVC Web application in VS15 Community, and then I replace the existing min.css file with another one (from bootswatch). And it doesn't change anything.
I have practiced mvc for a bit and every time I tried to change my layout later on in the project, it worked every time, but now as I just decided to get it out of the way straight up it just doesn't do anything.
You'll want to change the non-minified version as well.
Edit: Because the minified version is used when you publish and the non-minified version is used during debug, generally.

Working with SASS in a Mono WebForms Project

I am in the process of creating a website using Mono. It will be a standard webforms app (not MVC) but I'd like to use SASS for the CSS (specifically scss). However, I can't seem to get SASS to work with a mono webforms application. I tried using SassAndCoffee from NuGet and followed the standard setup instructions which said I should just reference my scss files as css files (e.g. application.scss would be referenced as application.css in a link attribute in the head. see http://blog.paulbetts.org/index.php/category/programming/mono-net/). That didn't work (or at least I'm assuming it didn't since my page rendered with no CSS and this scss has been tested on a rails platform so I know it works).
Next I tried using SquishIt which has an NSass wrapper. I followed the instructions here: http://www.cassandraking.net/wordpressapp/integrating-sass-into-net-using-nuget-and-squishit-sass/. This throw a 500 error because asp.net was unable to find NSass.Wrapper.proxy.dll. A quick google search led me to discover that because I was targeting "Any CPU", it couldn't choose between "NSass.Wrapper.x86" and NSass.Wrapper.x64". Sadly, however, MonoDevelop doesn't seem to want to give me the option to target x86 or x64 (the only option I have is to target "Any CPU").
I've kind of run out of options. Since I'm not using MVC, am I able to using SASS with a standard WebForms project using the Mono platform? Has anyone done this and can provide me some pointers?
In case anyone else runs into this, I never really found a viable solution in terms of a plugin. Honestly, Xamarin studio doesn't even seem to have a built in SASS editor as it isn't able to colour code anything in a SASS file. I ended up just using the sass command in terminal to convert a sass file to css. At a terminal prompt in the folder where your sass is kept type:
$ sass mysassfilename.sass:somecssfilename.css
To edit the sass file, I downloaded Microsoft's Visual Studio Code which has a version for the mac. It works rather well.

Twitter Bootstrap not functioning properly for Asp.Net MVC 4 application

I'm starting a new project with asp.net mvc4 internet application.
First thing I did was install a package called Twitter Bootstrap for Asp.Net MVC 4 Sample via nuGet.
This installed other two packages Bootstrap and Twitter Bootstrap for Asp.Net MVC 4.
When I run the application,I get this
I didn't face this problem in previous projects. When I installed twitter bootstrap, things were fine when i built the application.
Can anyone explain or suggest, what might be going wrong?
Edit 1:
I have another project where bootstrap works fine. When I run the two projects in chrome and check the network, file that are loaded for both the projects are same.
There is a file BundleConfig.cs (or a specific BootstrapBundleConfig.cs) in your "App_start" folder of your MVC4 project.
It will have a declaration of something like this:
// It won't look exactly like this..
bundles.Add(new StyleBundle("~/Content/bootstrap/css/style").Include(
"~/Content/bootstrap/css/bootstrap.css",
"~/Content/bootstrap/css/bootstrap-theme.css"
));
Now you must go to your "Views/Shared/_Layout.cshtml" file (or whatever you base layout is) and add the following line within your head section.
<head>
/// Other stuff in here
// This renders the boostrap style
#Styles.Render("~/Content/bootstrap/css/style")
// include any overrides to bootstrap you have after the library
</head>

Temporary scaffolding on rails 3

I'm new to rails and I'm actually reading a tutorial on it but unfortunately it's a very old one (2007). They talk about temporary scaffolding which is a one-line addition to a controller for example:
class StoryController < ApplicationController
scaffold :story
end
I tried it in my project but I'be got this error:
Routing Error
No route matches [GET] "/story"
Try running rake routes for more information on available routes.
I thought maybe it's because I'm running a different rails version, maybe the syntax have changed... So my question is how do we perform temporary scaffolding on rails 3.
I previously had to set config.assets.enabled to false because I had a route error.
I'm running under:
Rails 3.2.13
Windows 8 pro 32-bits
I'm very surprised to see this, because I wasn't around when Rails had this scaffold method you show. I've never heard of it before.
I searched the API documentation (and Rails source) and there is nothing like this now. Instead, there is the rails generate scaffold command. You can find more information at http://guides.rubyonrails.org/command_line.html.
As a suggestion: If you want to use a version of Rails from 2007, the tutorial you have now is fine. If you want to use a modern version, find a modern tutorial. The Ruby on Rails Guides site is good.

Resources