free hit counter CodeShare Addin for Visual Studio.NET - Nauman Leghari's Blog
Wednesday, November 24, 2004 12:14 PM laghari78

CodeShare Addin for Visual Studio.NET

[ CodeShare Addin updated for Visual Studio 2005

[ Now share source code from any application ]: With this new plugin and setup instruction, you can share source code from websites into a central database and insert them into VS.NET using the same interface.
See screen shots and download the plugin
Read these instructions to contribute code from any application


CodeShare Addin is a Visual Studio.NET plugin for sharing code snippets in an enterprise. It provides menu options within the IDE to contribute and find code snippets from a central repository.

After downloading and extracting the files from the zip package, you'll get the following three folders.
 a) Database: You'll find the database script here.
 b) CodeShareService: The Web service to setup on Server. You can change the Connection String in web.config .
 c) CodeShareAddin: The setup for CodeShare addin. 

There are two steps to install Codeshare Addin.

Server Setup:
 1. Create the database and other necessary entities by executing the codeshare_sql.sql file in the Database folder.
 2. Setup the CodeShareService folder as virtual directory.
Client Setup:
 1. Run the Setup.exe from the CodeShareAddin directory to install the addin and then start Visual Studio.NET IDE to complete the configuration. When you start Visual Studio.NET after installation, you'll notice the following dialog box to specify the URL of the Web service created in "Server Setup".

How It Works:
After completing the setup, you'll see two new options in the context menu of the Code Window

"Contribute Code":
 To share a piece of code snippet, select the appropriate code and press "Contribute Code" on the context menu.

 It will open the following dialog box with your selected code.

 1) If you would like to edit the web service URL then you can do so by putting the new URL in the text box and press "Save" to update it into the registry.
 2) Specify appropriate keywords to correctly index your source code snippet.
 3) The source code you selected from within the IDE. You can also edit the source code here.
 4) Your name, by default it takes the name of current logged in User. You can change it here to update profile.
 5) Submit button saves the snippet into the database.
"Find Code":
 To find a piece of code, go to the place where you need to insert the code and then select "Find Code" from the context menu.

 Selecting this option will open up the following dialog box:

 1) If you would like to edit the web service URL then you can do so by putting the new URL in the text box and press "Save" to update it into the registry.
 2) Keywords to search code snippets.
 3) A list box to display results.
 4) To display code for the selected item in the list box.
 5) Filter the list to only show snippets posted by you.
 6) Insert the selected code into the IDE

Try these after installation:

1 - Check whether the addin is successfully registered with Visual Studio.NET by examining the following registry entry


If you can't find this entry then follow step 2.

Otherwise, open Visual Studio.NET, goto Tools->Add-in Manager and confirm that you have "Enterprise Code Sharing" in that list. Then close the IDE and run the following registry file.

ReCreateCommands.reg.txt (Remove the trailing .txt before merging)

After merging the registry entries, try to re-open the IDE.
If still not successful then re-install the Addin and follow step 1 again.

2. Run the following registry file and re-open the IDE. If the problem persists, follow step 1.

codeshare.reg.txt (Remove the trailing .txt before merging)

Please provide your feedback and suggestions here.

If you like this then you might like my other Projects

Filed under: , , , ,


# re: CodeShare Addin for Visual Studio.NET

Wednesday, November 24, 2004 1:40 PM by Wessam Zeidan

I can't download the file

# re: CodeShare Addin for Visual Studio.NET

Wednesday, November 24, 2004 1:46 PM by Jerry

Any chance on the source code for this?


# re: CodeShare Addin for Visual Studio.NET

Wednesday, November 24, 2004 5:02 PM by Laurent Kempé

Nice idea !!! I will try it for sure.

# re: CodeShare Addin for Visual Studio.NET

Monday, November 29, 2004 9:56 AM by ShawnC

Any chance on seeing he source for the Add in?

This is a great tool, I'm willing to contribue $...

# re: CodeShare Addin for Visual Studio.NET

Friday, December 3, 2004 9:51 PM by Travis Laborde

Nice Addin! Thanks! I too would be willing to donate to make this even better.

Now for the feature requests.... :)

Can it be made to work from the HTML view? Or the XML editor, say in a web.config file? Or on a .js file? Basically, from any editor in the Studio IDE?

I really would like this functionality. With code, you at least get around a lot of cut and pasting by reusing components, but when you have to enter the same page directives on so many pages, and the same "base markup" for your DataGrids all the time, it gets old :)

Also - a small bug report - If you fail to edit the web.config file (your connectionstring) the Addin fails to work of course, but the error it reports is that it can't find the webservice, not that it can't find the database :)


# re: CodeShare Addin for Visual Studio.NET

Wednesday, December 8, 2004 4:41 PM by Will Sullivan

Nice, but I have problems with it. First off, the install wants to put the program in the directory "C:\Program Files\Default Company Name\CodeShareAddinSetup\". Not a big prob, but something that should be changed immediately, as it looks kinda bad. Second, the dang thing just doesn't want to work in my copy of VS. I'm using Architect, ver 7.1.3088, .NET framework SP1. The add-in shows up in my list, but doesn't appear to be running (not in the context menu for a .cs file). Any ideas?

# re: CodeShare Addin for Visual Studio.NET

Thursday, December 9, 2004 8:32 AM by Diederik Krols

Very nice and useful addin! The installation guide for the server could use a little bit more attention: it took me quite some time to figure out all SQL and IIS configuration/security issues. Anyway: this addin could become a hot item on GotDotNet or SourceForge.