.net core configuration in visual studio 2015, Hello world in .net core

Microsoft's powerful open source development platform .net core is the new trending technology in the tech market, so if you have visual studio 2015 you can do the development in easy updates.
So I will be explaining the steps required to configure the .net core in visual studio 2015.
1. download the visual studio update for 2015: download
    If you don't have the visual studio 2015: download
2. Download the .net core tool for the visual studio: download

I hope you have downloaded and installed all the above items, now we are good to go to the next step
So let us create a hello world console application using .net core
Select the new project option from vs you can see the .net core option under C#
select the console application and create one project with that


now you can just write the code in the same way you used to write with C#

The DLL generated in windows machine for this application you can run in Mac/Linux it will give you the same result.

you can check more details here :details

single setup using Install shield

If you are building setup using install shield by default the configuration selected will be DVD 5
In this case, the bin folder will not be consolidated in the setup it will be a separate folder.
to make it as the single one you have to change the configuration to SingleImage
Select your project> Build> configuration manager and change project configuration type to Single Instance

The term 'nuget' is not recognized as the name of a cmdlet, function, script file, or operable program

Once you run a NuGet command from visual studio package manager console you may get the above-mentioned error.
the solution for this is simple just install the NuGet command line

Error message: The term 'nuget' is not recognized as the name of a cmdlet, function, script file, or operable program Check the spelling of the name, or if a path was included, verify that the path is correct and try again

Solution : Install-Package NuGet.CommandLine



An unhandled exception of type 'System.Management.Automation.CmdletProviderInvocationException' occurred in System.Management.Automation.dll

An unhandled exception of type 'System.Management.Automation.CmdletProviderInvocationException' occurred in System.Management.Automation.dll Additional information: Index was outside the bounds of the array



>> once you try to load power shell script through c# program, some times you may get this generic error
     and if you go to the stack trace you will get the error details

    Attempting to perform the NewItem operation on the 'WebAdministration' provider failed for the path
    '\\\\server-  name\\Sites\\websitename'   Index was outside the bounds of the array.

   If you debug the application you will find difficulty  to figure out the route cause, I have faced this issue an as per my research in google got the solution so thought of posting it in blog

Solution : If you are trying to create new website using powershell and the IIS dosenot have any default website you will get this error message

by default default website will be there, if you remove that by mistake you will get this message, So resolution is add one dummy website.


Xamarin new world of opportunities for .net developers

Microsoft made it official that we are open for open source development, the big step towards that is made by the introduction of .Net core 1.0, its supported by Linux,OS X and Windows the big heads in the market. The  app world is evolving from desk top applications to web/cloud application and from there to smart app world.
As a .net developer there were so many limitations for smart app developments, you will be able to develop application only for windows phone, there was no cross platform support available till the discovery of Xamarin platform.
Xamarin is a cross platform supported frame work there you can code in C# and create beautiful applications which supports android,ios and windows what else you want ??

Microsoft acquired Xamarin in the February last 2016, still the business version of the frame work is payed one, for developing and studying purpose the student version is free.
There are improvements needed from a techie perspective because the current framework is not having the capability to code the application for one format and create the installers for other frameworks like if I have coded the applications for android, it should provide me the installers for iOS and windows vice versa,
currently the views for android is axml, for windows xaml, for iOs story board so this difference is restricting the framework from doing that. hope soon we will get the news like you code in one frame work we will give you the installers for other platforms

Setting Up Xamarin in Visual Studio

Hello World application using Xamarin C# Visual Studio Android



Hello World application using Xamarin C# Visual Studio Android

Set up Xamarin  in your visual studio.  follow the steps here
Create a blank android application in visual studio


Now you can check the solution explorer its contains the following folders, its pretty similar to the android eclipse blank application. here the view/layout file extension is .axml and the main activity file extension is .cs instead of java obviously its .Net so it should be like that.
here in c# we are invoking the android interfaces so you wont see much difference if you developed android application using java.

by default android emulator available if you configure xamarin in visual studio you can use other emulators also,I am using genymotion emulator for faster performance.

So I am going to build first application it has the code available to display the hello world functionality.
one button and on click it shows the count.
You will get the .apk file for your sample application inside the corresponding bin folder.
The sample code is pretty clear so not giving any explanation to that.
so lets start creating your apps.

Setting Up Xamarin in Visual Studio

As discussed in my previous post(Read), you can create mobile applications for all major platforms using c# and .Net
There are 2 IDE's available for Xamarin development, you can use Visul Studio or Xamarin Studio
Xamarin studio come along with Xamarin installer if you are using mac this your IDE, for windows users you can download the Xamarin for visual studio from below link.

Download Xamarin
Xamarin developer version is now free along with visual studio 2015.
Download :Visual Studio 2015

If you want you can use the different emulators,  by default along with Xamrin you will get android emulator, but its little bit slow.
Here is one third party tool you can use for android emulators, It will support from windows 7 onwards.
Genymotion Emulator : Downlaod

Another good tool is Hyper V Emulator : Download but there are some compatabilty problems with windows 7 so those are having windows 8 can go with this emulator.

Connection string form Web.config/App.Config using c#

Bangalore: To establish connection with database we need to declare the connection string. where ever you are making an operation with database you need to open the connection with db and you have to make the transaction. so its not good idea to use the connection string details in each page. It will affect he codes optimization/security etc.
so you can declare your connection strings inside the web.config file and you can return a common method to retrieve/return the connection string.


<configuration>
<connectionStrings>
    <add name="localhost" connectionString="Server=localhost; Database=TestDB; User ID=SqlAdmin; Password=TestPwd;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;"/>
  </connectionStrings>
</configuration>

Now we are going to write a method which will return the connection string. we can use it in a common page and we can re-use it in our pages depends on your requirement.


    public static String GetConnectionString
        {
            get { return ConfigurationManager.ConnectionStrings["localhost"].ConnectionString; }

        }