Tuesday 22 August 2017

Asp.Net Core Duplicate 'Content' items were included. The .NET SDK includes 'Content' items from your project directory by default

Hello Friends

I got one error message in asp.net core while upgrading to Visual Studio 2017 version 15.3.1

Duplicate 'Content' items were included. The .NET SDK includes 'Content' items from your project directory by default. You can either remove these items from your project file, or set the 'EnableDefaultContentItems' property to 'false' if you want to explicitly include them in your project file. 



So Solution for this error message is


  1. Click 'Show All Files' in Solution Explorer
  2. Right click over 'wwwroot' select 'Exclude From Project'
  3. Right click over 'wwwroot' select 'Include in Project'



Thanks
Sujeet 

 Happy Programming!!

Don’t forget to leave your feedback and comments below!

If you have any query mail me to Sujeet.bhujbal@gmail.com     

Regards
Sujeet Bhujbal
--------------------------------------------------------------------------------
-------------------------------------------------------------------------------

Friday 28 July 2017

What is ASP.NET Core


What is ASP.NET Core


ASP.NET Core is the latest Web application development framework from Microsoft. It is a redesign of the old ASP.NET framework and has already popular. ASP.NET Core is Open Source framework that you can use to build Web and Cloud applications. Most importantly, ASP.NET Core is available on Windows, Linux and Mac platforms.


Microsoft has made important changes with ASP.NET CoreNow, it is open source and available on GitHub. On GitHub, you can find everything about ASP.NET code and download it if you need


What is ASP.NET Core



In Visual Studio you will see 2 new project types
What is ASP.NET Core


New AppSetting.Json instead of web.config
What is ASP.NET Core





ASP.NET Core has a client side package manager which is inbuilt with ASP.NET 5 project and it is bower. It is a package manager for JavaScript, jQuery etc




·         In Old .Net applications when we make build for application all dlls goes into the bin directory, which is available inside the project. Now Bin directory has been placed inside the Artifact folder, which is new with ASP.NET 5.

·         Dependency Injection is supported by ASP.NET inbuilt. It supports DI by default. ASP.NET includes some built in container which supports constructor injection by default.

wwwroot folder will contain all the static content of the application in ASP.NET Core like js files, css files, images as well.






























ASP.NET Core has a client side package manager which is inbuilt with ASP.NET 5 project and it is bower. It is a package manager for JavaScript, jQuery etc

No VB.Net support as of now. It is to be added in future update.


Please check below microsoft article before choosing framework


Some Cons
·         Not all libraries are ready for core,
·         New means all api’s aren’t tested by the age..coz its new.
·         All stuff you do are new even to other people, so if you find a problem, you probably need to solve/figure it out on your won, because everyone is still new to it..




 Happy Programming!!

Don’t forget to leave your feedback and comments below!

If you have any query mail me to Sujeet.bhujbal@gmail.com     

Regards
Sujeet Bhujbal
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

Thursday 13 July 2017

Install Visual Studio 2017 Offline

Install Visual Studio 2017 Offline 


As Visual Studio 2017 is released, there is no ISO available for Visual Studio 2017 But we can download Visual Studio 2017 using command prompt


Step 1: First thing you need to download the installer from Visual Studio Website

https://www.visualstudio.com/vs/visual-studio-2017-rc/

Step 2:  Create a folder VS2017 in your drive. Here i create folder on E drive

Step 3 :  Now to download the offline installation files, you need to run the installer in the command line mode with a layout & language parameter. 

Step 4: Open the command prompt as administrator and enter the VS_enterprise.exe with the layout.For e.g. to create offline installation files for English, you can try the following command.

vs_enterprise.exe --layout C:\vs2017 --lang en-US

Install Visual Studio 2017 Offline


Step 6: After entering the command,  another dialog will open as follows.

Install Visual Studio 2017 Offline

Step 7: After that, it will give you the progress about the downloading of packages.


Install Visual Studio 2017 Offline


Once all the required packages are downloaded, this command prompt will close automatically. At any moment, you can use the same command again so that new updates will be downloaded.


Step 8 : Install Certificates

In the layout folder, you will find a certificates folder with several certificates.



 Right click on each certificate and install them.



A wizard will start and guide you through the installation process. I didn’t change any default values in the wizard, just click Next in each step until you reach the last step.




Click Finish button, you will get a success message if everything ok.





Repeat the same for each certificate available in the certificates folder. Once you installed all the certificates, you can start Visual Studio installation. 


Step 9: Installing Visual Studio 2017 using exe. In the layout folder, you will find vs_enterprise.exe. 





Step 10 : Run vs_Enterprise.exe and the installation will start immediately, click continue in the splash screen








Step 11 : You will see the new installation experience of Visual Studio 2017. You can select the necessary components and click on the install button.












Note : You can download community edition as it is free for developer and Total size the of visual studio is 18GB if you select more features then size may increase.





 Happy Programming!!

Don’t forget to leave your feedback and comments below!

If you have any query mail me to Sujeet.bhujbal@gmail.com     

Regards
Sujeet Bhujbal
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------


Wednesday 24 May 2017

How to pass data from one view to another in ASP.NET MVC

You may come across a situation where you may wish to pass data from one asp.net razor view to another. There are a number ways of doing the same.
1. Using Partial Views
One commonly used way to pass data from one view to another is you can create a dynamic anonymous object and pass it to the partial function
1
@Html.Partial("viewname", new {item1="value1", item2 = "value2"})

Now in your partial view, you can use dynamic keyword to access the data in the partial view. The view should look like

1
2
3
@model dynamic
<div>@Model.item1</div>
<div>@Model.item2</div>
2. Use TempData
This is useful when your partial view accepts model of another type or you wish to use any existing partial view and pass data to it. TempData uses an indexed dictionary with key and value to store the data.
So in your view where you wish to include the partial view, you write it like:

1
2
3
4
5
@{
TempData["item1"] = "value1";
TempData["item2"] = "value2";
}
@Html.Partial("viewname")
Note how we used string keys to define our data values. You can create as many keys as you want.
Note that if you add the same key again, it’ll overwrite the previous value.
Now in your partial view, you can use the data as:

1
2
3
4
5
@{
if(TempData["item1"] != null){
//use TempData["item1"] to retrieve the value
}
}
A null check before retrieval of data ensures that the Razor engine doesn’t throw any error in case no data has been passed.
Note that life of TempData  is only till the current request completes. It’s not available thereafter
3. Using Session Variables
The usage syntax of session variables is similar to TempData except that the lifetime of a session variable is for the entire browser session (or an expiration time of 20 minutes default).


 Happy Programming!!

Don’t forget to leave your feedback and comments below!

If you have any query mail me to Sujeet.bhujbal@gmail.com     

Regards
Sujeet Bhujbal
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------