Before some time, I have published a blog post for using Github with Visual studio team explorer. So with reference to this blog post, one of the users email me that how we can publish the existing applications to Github? So I thought it would be a great idea to write a blog post about it. So in this blog post, We are going to learn how we can publish existing application to Github with visual studio 2015. Visual Studio 2015 comes with Team explorer and when you install the visual studio 2015 there is an option to install the Github extension for visual studio. If you have not installed it then you can also insert separately from the following link.
https://visualstudio.github.com/
Once created application, I have added it to the source via right clicking solution explorer and Click on Add Solution to Source control.
It will add the solution to default source control, In my visual studio git is configured as default source control. But if it not there it will ask between Git or Team server. Once you click on add solution to source control it will create a local git repository. Now It’s time to write some code. Here is a sample code that I have written.
Now once you click sync it will try to sync with the remote repository of GIT since we don’t have the remote repository.
Here, there are three options available, Github, Team Services or custom remote repository. Since we are going to use Github so click on GetStarted for GitHub option. It will load following screen.
Here in above screenshot, My Github account is already configured otherwise it will ask for your Github Credentials. Now click on publish it will create a new repository in Github and publish the whole history to GitHub also.
You can see the same thing on Github.com also.
That’s it. It’s very easy to use Github tools with Visual Studio 2015. Hope you like it. Stay tuned for more!!.
https://visualstudio.github.com/
How to publish existing applications to Github with Visual Studio 2015:
To demonstrate this we are going to use console application, So I have created a core console application with File-> New project.Once created application, I have added it to the source via right clicking solution explorer and Click on Add Solution to Source control.
It will add the solution to default source control, In my visual studio git is configured as default source control. But if it not there it will ask between Git or Team server. Once you click on add solution to source control it will create a local git repository. Now It’s time to write some code. Here is a sample code that I have written.
using System; namespace GithubConsoleApp { public class Program { public static void Main(string[] args) { Console.Write("Github sample application"); Console.ReadLine(); } } }Now it's time to commit code to Local Git repository with team explorer like following.
Now once you click sync it will try to sync with the remote repository of GIT since we don’t have the remote repository.
Here, there are three options available, Github, Team Services or custom remote repository. Since we are going to use Github so click on GetStarted for GitHub option. It will load following screen.
Here in above screenshot, My Github account is already configured otherwise it will ask for your Github Credentials. Now click on publish it will create a new repository in Github and publish the whole history to GitHub also.
You can see the same thing on Github.com also.
That’s it. It’s very easy to use Github tools with Visual Studio 2015. Hope you like it. Stay tuned for more!!.
You can find sample Github repository used in this application at - https://github.com/dotnetjalps/GithubConsoleApp
0 comments:
Post a Comment
Your feedback is very important to me. Please provide your feedback via putting comments.