I’ve been trying to get the (highly regarded) CopySourceAsHtml add-in to work under Visual Studio to make it easier to post code samples. Every time I tried loading it, it was failing with:
The Add-in 'CopySourceAsHtml' failed to load or caused an exception.
Would you like to remove this Add-in?
If you choose yes, the file it was loaded from, '\\wtz-srv-dc01\Users\paul.mrozowski\My Documents\Visual Studio 2005\Addins\CopySourceAsHtml.AddIn', will be renamed.
Error Message:
Error number: 8013150a
I tried downloading the source, recompiling, making some suggested changes to the control references. Nothing seemed to help. As soon as I attempted to activate the add-in, it was failing. Then it suddenly occurred to me: what if it’s related to the fact that “My Documents” is on a network drive? To test this idea, I created a new local folder, then when into Tools > Options > Environment > Add-in/Macros Security. I added a new local folder which had a copy of the add-in and exited VS and restarted. Finally, I when to Tools > Add-ins and reselected the CopySourceAsHtml add-in. No errors!
I copied and pasted some code (and selected Override for the font to add Courier New as a secondary font). (random code shown below).
/// <summary>
/// Process events from the grid
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
/// <developer>Paul Mrozowski</developer>
/// <created>10/16/2007</created>
protected void grdTemplates_ItemCommand(object source, Telerik.WebControls.GridCommandEventArgs e)
{
if (e.CommandName == "Edit")
this.EditRecord(e.Item);
else if (e.CommandName == "Cancel")
this.grdTemplates.EditIndexes.Clear();
else if (e.CommandName == "Add")
this.AddRecord();
else if (e.CommandName == "Test")
this.TestQuery(e);
else if (e.CommandName == "Update")
this.UpdateRoles(e);
}
Here's a screenshot as a comparison:
Links:
CopySourceAsHtml
http://www.jtleigh.com/people/colin/software/CopySourceAsHtml/
Getting it to run under VS 2008 Beta 2
http://diditwith.net/2007/08/16/CopySourceAsHtmlInVisualStudio2008.aspx