By: Andy Novick | Updated: 2017-06-07 | Comments | Related: More > Scripts
Problem
Open source projects need an open platform to live, preferably one with source code management, download management, and a discussion forum for each project. Microsoft created CodePlex as such a site back in 2006. In April of 2017 they announced that it would be closing in favor of hosting on GitHub. I’ve hosted a project named SQL Job Scripter on CodePlex since 2012. How am I going to move it from CodePlex to GitHub?
Solution
For several projects I created a large number of SQL Server Agent Jobs, around 50, to get some very large tasks completed in parallel. SQL Job Scripter was written so that those jobs could easily be turned into text files and either moved to another server or be checked into source control. Since it worked so nicely I’ve used it on all my jobs and saved them away in TFS, just in case they were needed and to track the occasional change.
When I saw the notice that CodePlex would be closing I was a little saddened. I’ve pulled several projects from CodePlex over the years and found it very helpful. Time marches on and the need for a Microsoft only open source web site just isn’t there anymore. You may remember 2001 when Steve Ballmer railed against open source and called Linux a Cancer. In recent years, Microsoft has done a lot of changing and they maintain key portions of their development tools and development environment as open source projects on GitHub. I’m talking about tools like the Roslyn compiler for C# and Visual Basic as well as the .Net Core. They even use it for some of their private development projects.
What are Git and GitHub?
Git is the distributed source control system that was originally created for Linux development. Like a lot of Linux, Git is a command line tool. However, there is now a git-gui and there are third party tools to work with Git and most importantly Visual Studio 2015 and 2017 have built-in support even in the community editions. Git supported on Linux, Max and Windows. It’s free and distributed under the GNU General Public License version 2.0. You can download git from https://git-scm.com/downloads.
GitHub is a Git repository and web site to host Git based projects. It adds a web interface and every project can have a wiki easier to use than the command line. GitHub is free for open source projects but can also be used on a paid basis for private projects. Many development tools, support Git and GitHub for source control. One exception is SQL Server Management Studio (SSMS). GitHub offers more than source control. Each project can have an issue tracker and a Wiki to go along with the source control.
Moving SQL Job Scripter
To get started with moving the SQL Job Scripter project to GitHub I started by going to https://github.com and created an account. They require only a user name, e-mail address and password. You can add a picture, description and a few other items like your employer and web site. My profile is at https://github.com/anovick.
There is a migration tool on CodePlex that is supposed to allow you to move a project to GitHub. I found that it didn’t work. Attempts to complete the process with this tool failed in IE, Firefox and Chrome. Others have reported similar failures. I also went down the command line path with a tool called git-tf. That also didn’t succeed.
After some research I decided to try Visual Studio. I started with the project on my hard drive and I opened it in Visual Studio 2017, which has built in Git Support and then opened Team Explorer:
In the GitHub area I hit the Create button that you see above and was asked to login to GitHub and then fill in a screen to create the project like this:
That worked and Team Explorer showed my project:
On the GitHub we site only the README.md and .gitignore files were present. I still had to check in the VS solution, project and .CS files.
The next step is to add the solution to source control with the File > Add to Source Control menu. That seemed to work. And the Output windows even showed that there was a commit
When I went to the web GitHub repository again the README.md and .gitignore files were present but none of my project files were there. It turns out that the commit was only in the local repository on my computer. To get the code to the GitHub repository it must be synced. I found that on the Team Explorer here:
Pressing the blue “Sync” link lead to the Synchronization window:
I pressed “Publish to GitHub” and some additional fields opened. I filled them and pressed the Publish button.
In a few seconds it showed the connection to the project:
Clicking on the link lead to the GitHub site and my files were checked in!
The README.md file was no longer there but I added one with the full description of the project. I’ve also added the documentation to the Wiki of the project. Here’s the documentation for you:
SQL Job Scripter is a command line utility that produces scripts of SQL Agent jobs. It will script either to a single file or to one file per job, suitable for source control.
switch | parameter | description |
---|---|---|
-S | server_name | server name to connect to |
-d | directory | output directory use double quotes if there are spaces |
-p | prefixofjob | prefix of the job name to select ex: "DBA_" |
-1 | one_file | put the output into just one file |
-m | many_files | put the output into many files |
Here’s an example command line:
sqljobscripter -S (local) -p DBA_ -m -1 d "c:\source control\server1\jobs"
The defaults for server, directory and prefix are also in the sqljobscripter.exe.config file so they don’t have to be on the command line.
I build the EXE from the Visual Studio project and move it to my server then run it from a SQL Agent Job every day storing the results on a network directory. Then as I make changes I’ll check in the changes to TFS. Not GitHub. At least, not yet.
Finally, the project on CodePlex should be changed to let everyone know that it’s been moved to GitHub. That’s done by going to the Settings tab of the project on CodePlex and there’s a field to enter New Project Location:
Next Steps
Give SQL Job Scripter a try. You can pull the project by going to the site and hitting Open in Visual Studio or download the whole project as a zip file. That doesn’t even require a GitHub account.
- Watch the GitHub intro video https://github.com/features
- Read the introductory guide https://guides.github.com/activities/hello-world/
- Explore GitHub and Git documentation and video guides on the GitHub site
- Examine some of the GitHub example projects https://github.com/showcases/github-pages-examples
- Remember: mîlle viae dûcunt hominçs per saecula GitHub
About the author
This author pledges the content of this article is based on professional experience and not AI generated.
View all my tips
Article Last Updated: 2017-06-07