I had the need today to take a bunch of JavaScript code and paste it into an ASP.NET code behind file. I was using the script as a basis for a custom script that was placed into the Page using the ClientScript.RegisterClientScriptBlock method. I did some quick googling and found the Visual Studio Add-In called Smart Paster from Alex Papadimoulis that was just what I was looking for. It wasn’t supplied in compiled form, but it was easy to build and deploy. Just open the solution file, compile for Release mode and then copy the two files (from the bin folder) into your Addins folder:
- SmartPaster2008.AddIn
- SmartPaster2008.dll
Note: Your Addins folder is located by default at C:\Users\<username>\Documents\Visual Studio 2008\Addins
Simply restart VS2008 and now check out the new Right Click “Paste As” menu option:
There are some options via the Configure menu item too. Very handy!