Where are jQuery-UI scripts stored in MVC6 project? - jquery-ui

I'm starting with MVC6 and I'm trying to use some jQuery-UI elements.
After installing the package, I cannot find the script files of jQuery-UI. While lot of tutorials on the internet tell that the files should be stored in Scripts folder (for example: <script src="#Url.Content("~/Scripts/jquery-ui-1.10.4.min.js")"></script>), it seems that it isn't the case with MVC6.
I saw this question (How to get JQuery-UI to work with ASP.NET MVC6?) in which the file is retrieved from jQuery site : <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>.
Is there any way to have files stored on our server as before ? Where are these files stored in MVC6 project ?
Thanks.

I spent a long time trying to figure this out when I first started using .NET 5 as well. Don't install client packages with NuGet in .NET 5. Use Bower.
To install it with Bower, expand the "Dependencies" item in your project in the solution explorer. You should see a "Bower" folder there. Right-click on it and select "Manage Bower Packages". At the top of the window that opens you can choose "Browse" and then search for "jquery-ui". It should show up in the list below and you can select it and click the install button.
Once it's installed, you can find it under wwwroot/lib/jquery-ui
Then, you can reference it like this <script src="~/lib/jquery-ui/jquery-ui.js"></script>
--UPDATE--
I've been using NPM now for client packages, but the point still stands. Don't use NuGet for client packages.

Related

Override bootstrap in .net core 2.0 using less

In good old ASP.NET we would install Bootstrap as a NuGet package and it would install all the files in the ~/Content/bootstrap directory. This made it easy to create a custom bootstrap.less file that imported Bootstrap so that we could override what we wanted while still keeping the library intact so it could be updated at any time.
For example I could do this in my custom less file to enable a special bootswatch theme with some custom variables and overrides. I could then compile it and add it to the site css.
#import "bootstrap/bootstrap.less";
#import "bootstrap/_variables.less";
#import "bootstrap/_bootswatch.less";
#import "custom.less";
In dot net core 2.0 there is no ~/Content directory by default and css is really served from the new wwwrootdirectory. When installing Bootstrap through NuGet now, it is added as a "Dependency". I can't find a way to import the bootstrap less files as I used to though since I don't know the path, if there even is one.
I have created a custom ~/Styles/bootstrap.less file in which I try to use the imports above but the compiler can't find them. I have found the .less files in /packages/bootstrap.less.3.3.7/content/Content/bootstrap.less in my solution root but that does not seem to be accessible to the import-statements.
#import '../../packages/bootstrap.less.3.3.7/content/Content/bootstrap.less';
The error I get is simply:
FileError: '../../packages/bootstrap.less.3.3.7/content/Content/bootstrap.less' wasn't found.
Tried - [SOLUTIONPATH]\packages\bootstrap.less.3.3.7\content\Content\bootstrap.less,
....\packages\bootstrap.less.3.3.7\content\Content\bootstrap.less in \Styles_bootstrap.less
How can I override the bootstrap less files? Do I have to download bootstrap myself into my ~/Styles/ directory to be able to import them? That would ruin the possibility of updating through NuGet :/
.net core has stopped supporting Nugets for client side codes. Creating a new .net core project with either vs 2017 or using the cli dotnet new mvc would by default include the bower packages on the wwwroot/lib folder. To manage bower packages you can right click on the project and select "manage bower packages". Also note that .net core mvc by default is only configured to use the wwwroot folder as the client side content. Besides this, the compiled views are the only other content that are given to the client. This means that and Styles or Contents folder you create wouldn't be a client side code by default. You can add theses folders in the set up but its not recommended. The js and css files can be found in folders inside wwwroot.

Angular.js NuGet vs core reference?

In Visual Studio, when you add the Angular.js NuGet package, it adds a ton of angular javascript files. I've always just added the direct reference to angular.js (local or via google URL) to my projects and it always works fine.
What's the reason for using the NuGet version of Angular.js?
With Nuget it's easier to get all dependences (if they exists) and monitor updates when they comes out and install them.
But in case of Angular.js Nuget still just copy some js files in your project. So if you don't plan to follow updates and you know all dependences you can just copy your files.

Importing an UMBRACO site into Visual Studio

Is it possible to import an already existing Umbraco site into Visual Studio? (By means of getting all the site files and DB backup)
I've tried creating an empty project and copying the website files, but I get several errors when I try to compile the solution. The errors look like "Could not find scheme information for the element 'umbracoConfiguration'."
The same happens if I create an empty solution, add the UMBRACO nuget package, and then copy the website files.
I'm wondering if it is at all possible, or if once an UMBRACO website is running, how should one customize/develop on it?
THANK YOU!
After several attempts and trial and error, as well as reading other blogs, the way it worked for me was to go in Visual Studio -> File -> Open -> Web Site... and select the main folder containing all the files.
It is important to know that the web.config had to be modified in advanced for the website to work to point to the local server and off course attach the DB to the local SQL server.
Everything works perfectly just the way it was working on the host, and I have the solution in Visual Studio.
I like to start with nuget because it handles setting up all of my project references. I create a new MVC4 Web Application
Visual Studio->File->New->Project->MVC4 Web Application
After I create the new application, I open the Nuget Package Manager Console
Tools->NuGet Package Manager->Package Manager Console
I then enter the command:
Install-Package UmbracoCms.Core -Version 7.2.1
I find that installing the UmbracoCms.Core instead of the whole UmbracoCms nuget package is best because it only sets me up with the umbraco dlls and sets up the references for me. The UmbracoCms nuget package tries to do a lot more and is more handy if you are setting up a brand new umbraco site in Visual Studio.
Once I have nugetted the appropriate version of umbraco, I copy my existing umbraco site files over the files that were nugetted. When you copy all of the files over, don't copy all of the App_Data. Most of the files in that directory are TEMP files and cache files. From App_Data, only copy the following. This will save you time reindexing the site. I suspect a lot of the App_Data files were responsible for your Object Null Reference.
App_Data/access.config
App_Data/packages/*
In visual studio, in the solution explorer, click "Show All Files", and then include the appropriate files in the solution. Rebuild the solution, and you should be set up for development.

direct nuget where to put files

I am working with nuget and find it excellent with my MVC4 project. I use it for all my external dependencies.
I have run in to one small problem with it. For example, installing the jQuery package, it places the jQuery files in to the Scripts folder. My preference is that it places the javascript files in to a libraries folder within scripts. So instead of
Scripts/jquery-1.8.3.js
I want to place it in
Scripts/libraries/jquery-1.8.3.js
Yes I can manually move it but then I lose the features of nuget. Any way that I can direct where a package places the files like this?
This is not supported yet
dupe of
NuGet scripts to different directory
, nuget codeplex issue is here http://nuget.codeplex.com/workitem/1914

Installing Umbraco 4.7

I am new to Umbraco and i have heard lot good about this cms.
I want to start Umbraco, but here are newbie questions.
How to Install Umbraco on my local machine.
Ones I make Umbraco work according to my need, what are requirement for deploying on Shared Hosting.
How to deploy on Shared Hosting Server.
Thank You.
Go for Webmatrix - Umbraco setup 30 sec.! www.asp.net/webmatrix
In answer to question 2. Yuo will need the dot net framework installed (4.0) - some hosts say it is but I have known at least one where the avertising blurb did not match the actual enviroment. You also need SQLExpress (2008 R2 is you best version). Once these are up and running, its the same as any database & iis app.
Another thing I found useful, is that Umbraco also provides a WebDeploy (http://www.iis.net/download/webdeploy) package that makes it very easy to deploy on IIS:http://umbraco.codeplex.com/releases/view/73692 look for 'Umbraco_4.7.1_WebDeploy_NET_4.0'.
I do the initial deployment on my development machine, the release to production could be as simple as a copy and paste (plus the db-release).
Hope this helps,
-covo
Umbraco ships in two type of packages.
Zip Package
Nuget Package
1) Zip Package
Zip package contains an Asp.Net website with Umbraco pre-installed in it. All you have to do is to extract the package inside a local directory, host the directory in IIS as a website and open in browser. Umbraco will guide you through the configuration steps, you can also install a starter kit that is a sample website template and is pretty fancy. Umbraco ships three starter kits along with installation package you can chose the one of your choice.
Step 1:
Navigate to umbraco download url and hit “Download Umbraco version*”: https://our.umbraco.org/download/
You’ll get a zip package of nearly 20MB size.
Step 2:
Extract the zip package into a folder and put that folder on any of your computer’s drive.
Step 3:
Open IIS Manager, add new website and point it to your Umbraco folder and start the website.
Step 4:
Now, browse this website, you’ll see the configuration page would appear, enter your name, email and password for Umbraco dashboard, remember your email id would be used as a user name for logging in dashboard. You can see you have two buttons; Install and Customize, Clicking install would get you the standard features in which you get “.sdf” database file inside your project’s “App_Data” folder. Customize on the other hand provides us with many handy configuration options. We’ll follow the customize route to get good understanding of the process.
Step 5:
When going for customized installation, you’ll see the database configuration options. Configure them according to your choice, Note that you’d have to specify a Database server and database name, you can create a new database on your server and you can use an existing database as well. Alternatively, you can select the SQL Server Compact Edition option from dropdown which would create “.sdf” database inside your project.
Step 6:
The next step in configuration would allow you to install a starter kit, starter kits are built in website templates. Let’s just select one of them for sake of learning although you won’t be needing them once you’d be well versed with the components in Umbraco Dashboard. Click on any of the three starter kits and let Umbraco do the magic.
It would take a couple of minutes and then you’ll be redirected to dashboard of your brand new website powered by Umbraco. Welcome to the Umbraco World. You can navigate to the installed website by removing Umbraco from URL. In our case http://localhost/ would show you the website
and http://localhost/umbraco would take you to the dashboard.
2) Nuget Package
Umbraco is also available in Nuget Package Repository. Follow the steps to install Umbraco using Nuget.
Step 1:
Create an Asp.Net or Asp.Net MVC Project in visual studio.
Step 2:
Open Package Manager Console and run the following command: “Install-Package UmbracoCms"
Umbraco will start installing inside your web application. Alternatively, you can right click on your project, hit Manage Nuget packages, find Umbraco CMS there and install it. There’s a slight possibility that your installation fails with error, normally updating the Nuget version solves the problem. Once the Umbraco is installed inside your project you can either run it by hitting F5/ Play from visual studio or you can host a website in IIS like we did in Umbraco installation from a ZIP package.
Step 3:
Once you've managed to browse your web application project in browser, All the next steps are same as ZIP package installation, specify login credentials, configure database and starter kits and Bingo! Umbraco’s installed.

Resources