Wednesday, January 6, 2016

ASP.NET 5 folder structure

Hi All,

In ASP.NET 5 Microsoft targeted to change the solution folder structure.  Here is the sample solution structure.



The first thing you may notice about this new structure is that it includes a Solution Items folder with a global.json file, and the web project itself is located within a src folder within the solution. The new structure also includes a special wwwroot folder and a Dependencies section in addition to the References section that was present in past versions of ASP.NET (but which has been updated in this version). In the root the project there are also several new files such as bower.json, appsettings.json, gulpfile.js, package.json, project.json, and Startup.cs. You may notice that the files global.asax, packages.config, and web.config are gone. In previous versions of ASP.NET, a great deal of application configuration was stored in these files and in the project file. In ASP.NET 5, this information and logic has been refactored into files that are generally smaller and more focused.

global.json file

The global.json file is used to configure the solution as a whole. It includes just two sections, projects and sdk by default.

The projects property designates which folders contain source code for the solution. By default the project structure places source files in a src folder, allowing build artifacts to be placed in a sibling folder, making it easier to exclude such things from source control.

The sdk property specifies the version of the DNX (.Net Execution Environment) that Visual Studio will use when opening the solution. It’s set here, rather than in project.json, to avoid scenarios where different projects within a solution are targeting different versions of the SDK

Dependencies

Now MSDN maintaining client side and server side dependencies/references as a separate folders

Dependencies folder : This will be used to maintain client side dependencies with the help of bower and node.js

References will have server side dependencies

bower.json : Client side packages/dependencies configuration file. It works with bower (a client side framework manager)

wwwroot : It contains the static files like images, scripts etc







Sunday, May 11, 2014

Disable model validations while submitting the form in MVC

Add below line in the top of the view.
@{
           Html.EnableClientValidation(false);
    }

Friday, March 28, 2014

No exports were found that match the constraint :ContractName Microsoft.VisualStudio.Utilities.IContentTypeRegistryService


Issue description : 

No exports were found that match the constraint:ContractName
Microsoft.VisualStudio.Utilities.IContentTypeRegistryService
RequiredTypeIdentity
Microsoft.VisualStudio.Utilities.IContentTypeRegistryService

Solution : removing all the files from following visual studio ComponentModelCache folder

COMPONENT MODEL CACHE folder location : C:\Users\{YourUserName}\AppData\Local\Microsoft\VisualStudio\11.0\ComponentModelCache

Friday, February 28, 2014

LESS : Dynamic CSS language

Recently come across the using LESS in one of my project. LESS looks very cool and provides the programming capabilities to CSS. Like using LESS in CSS, we can define variables, functions and much more and reuse them across the multiple css pages.

By default every CSS page is a less page.

We can achieve the LESS in a project in two ways.
1.Client side.
2. Server side.

Client side: It will costs the performance cost. Because when ever user requests a page browser needs to convert css file to LESS.

Server Side : when you add the LESS the less at server side it will automatically converts the CSS to LESS while building the application.

You can download the "dotless" package from Nuget.

For more Information, Please refer below reference urls

LESS -> http://lesscss.org/
LESS in dot net -> http://www.dotlesscss.org/

HAPPY CODING :)

Sunday, January 19, 2014

How long the view location will be cached in MVC?

The default cache is 15min.

we can extend this using follwing code in Global.asax


var viewEngine = new RazorViewEngine
                         {ViewLocationCache = new DefaultViewLocationCache(TimeSpan.FromHours(24))};
    ViewEngines.Engines.Clear();
    ViewEngines.Engines.Add(viewEngine);

Monday, November 11, 2013

New features in .NET 4.5


  • Async and wait 
  • Zip Compression
  • Regex timeout
  • Improvised garbage collector
  • Profile optimization (Improved startup performance)
  • Set default culture to App Domain  (helpful in working on multi threaded environment)
  • Array support more than two gigabyte size
  • Asynchronous HTTP Modules and Handlers.
  • New Request Validation features in Asp.Net 4.5

Saturday, August 24, 2013

What are the new features introduced in MVC4




  1. ASP.NET Web API
  2. Enhancements to default project Templates
  3. Mobile Project Template
  4. Display Modes
  5. JQuery Mobile
  6. View Switcher
  7. Browser Overriding
  8. Task Support For Asynchronous controller
  9. Empty Project template