Thursday, June 9, 2016

NuGet Commands Asp.net



Get List of Installed Packages :-
Get-Package -ListAvailable

Get-Package -ListAvailable -Filter elmah

Install- Package :-
Install-Package elmah

UnInstall-Package :-
Uninstall-Package elmah

Updating Package :-
Get-Package -updates

Updating Nuget :-
nuget.exe update -self


INSTALLATION ERROR IN NUGET:-
Install-Package : 'AutoMapper' already has a dependency defined for 'Microsoft.CSharp'.
At line:1 char:16
+ Install-Package <<<<  AutoMapper -Verbose
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

Solution:-

  • Find the Cache folder of VS 2012's Nuget Package Manager (with Tools - Options - Nuget Package Manager)
  • Open AutoMapper.5.x.x.nupkg with your favorite Zip Tool
  • Modify the file AutoMapper.nuspec - I simply deleted all dependencies except .NETFramework4.5
  • Add the cache folder as a Nuget source (also in Tools - Options - Nuget Package Manager)
  • Install Automapper either with the console or the GUI but make sure to choose first the newly added cache folder as package source.

Reference URL:- https://docs.nuget.org/consume/package-manager-console 

ASP.Net MVC BreadCrum - MvcSiteMapProvider



https://edspencer.me.uk/2011/09/20/mvc-sitemap-provider-tutorial-2-breadcrumbs/

https://msdn.microsoft.com/en-us/library/yy2ykkab.aspx

http://www.codeproject.com/Articles/1008883/Breadcrumb-in-MVC

http://maartenba.github.io/MvcSiteMapProvider/getting-started.html  (Advance)
    Don't like XML configuration?

Sunday, June 5, 2016

PlaceHolder in ASP.NET MVC 5.2.3


1) With use of MVC Data Annotations:
     Model:
    [Required]
    [Display(Prompt = "Enter Your First Name")]
    public string FirstName { get; set; }

    Razor Syntax:
    @Html.TextBoxFor(m => m.FirstName, new { placeholder = @Html.DisplayNameFor(n => n.UserName)})
 
 
2) With use of MVC Data Annotations But with DisplayName:
 
  Model:
   [Required]
   [DisplayName("Enter Your First Name")]
   public string FirstName { get; set; }  
 
  Razor Syntax: 
     
@Html.TextBoxFor(m => m.FirstName, new { placeholder = @Html.DisplayNameFor(n => n.UserName)})
 
 
3) Without use of MVC Data Annotation (recommended):
 
 @Html.TextBoxFor(m => m.FirstName, new { @placeholder = "Enter Your First Name")