Thursday 22 June 2017

Started with Visual Studio Code

Prerequisites:
Start Sample Application
  1. Open Visual Studio Code 
  2. Select the folder.  
  3. Go to View ->  Click Integrated Terminal Window(CTRL+`)
  4. Type "dotnet new"
  5. It will show the Templates
    • Console Application - Type dotnet new console
    • Class library - Type dotnet new classlib
    • Unit Test Project Type dotnet new mstest
    • xUnit Test Project - Type dotnet new xunit
    • ASP.NET Core Empty - Type dotnet new web
    • ASP.NET Core Web App - Type dotnet new mvc
    • ASP.NET Core Web API  - Type dotnet new webapi
    • Solution File -Type dotnet new sln
  6. Type dotnet restore (Running restore pulls down the required packages declared in the project.json file.)   
  7. Type dotnet build
  8. Type dotnet run
  9. Type dotnet publish
  10. Type dotnet clean
Local Nuget Package path:
  • C:\Users\username\.nuget\packages
Publish and Host IIS :
  • Type dotnet publish
  • Host Path : ...\bin\Debug\netcoreapp1.1\publish
     Error: Show Error Code 0x8007000d -> Ckeck installed "windows server hosting bundle" and     "Url Rewrite "

Add Nuget Package(Entity Frame Work):

<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
OR
  •  dotnet add package Microsoft.EntityFrameworkCore.SqlServer
  • dotnet add package Microsoft.EntityFrameworkCore
  • dotnet add package Microsoft.EntityFrameworkCore.Relational
  • dotnet add package Microsoft.EntityFrameworkCore.DbContext
  • dotnet add package Microsoft.AspNetCore.Mvc.Core


Remove Nuget Package:
  • dotnet remove package <package name>
Add library Package Reference in .csproj:
  • <ProjectReference Include="..\Test1\Test1.csproj"/>

Connect SQL Server:
     Link - https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-develop-use-vscode

Popular Extension:
  1. OmniSharp
  2. Csharp-ASPNETCore(auto generater code -> In controller-> type ->MVC-core-get)
  3. wilderminds-aspnetcore-snippets(type cs file ->EF-dbcontext auto generated entitiy framework code)
  4. mssql(conntect sql database)
  5. vscode-icons(file icon)
  6. html-snippets
  7. aspnet-helper
  8. Auto Close Tag
  9. Auto Rename Tag
  10. Go(gocode)
  11. Code runner
  12. Notepad++ keymap
  13. Spelling Checker

Monday 12 June 2017

How to set Development Environment

Following code add the startup.cs file

env.EnvironmentName = EnvironmentName.Development; if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); }