Microsoft

ClientScriptManager…why didn’t that work

NET 2.0 added the ClientScriptManager to allow developers a simple method to add javascript and other "Script" capabilites to a web page easily.  However, the documentation never really got developed, so attempting to use it can be a bit trick.

 
Lets start with adding an include of a .js file.

protected

override void Render(HtmlTextWriter writer)
{
if (!this.Page.ClientScript.IsClientScriptIncludeRegistered(this.GetType(), VirtualEarthSettings
.VirtualEarthJScriptTagHeader))
{
this.Page.ClientScript.RegisterClientScriptInclude(this.GetType(), VirtualEarthSettings.VirtualEarthJScriptTagHeader, http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6
);
}
base
.Render(writer);
}

Didn’t work did it? 

Why?
You can’t call RegisterClientScriptInclude(…) after the PreRender section of the page lifecycle.  Best bet: call in OnInit.
 
In fact about the ONLY ClientScriptManager function you can use after the PreRender is: ClientScript.RegisterStartupScript

Troubles with TFS

I recently inherited a project from a fellow ML developer who had been having issues getting the project checked into source code.  I attempted checking the code in myselft and received the following error:
 
The project cannot be added to source control because it overlaps a project that is already bound to source control at a lower root.
 
A little research and here is what I found was the issue.  The solution contained two projects, one a Library and the other a WebPart.  The solution referenced the WebPart’s Assembly Key, the key used to sign the assembly, as a solution item.  When Visual Studio attempted to check the code into Source Control through TFS Team Explorer the error would occur.  This is because Team Explorer was trying to check in the Solution Items as thought they were physically located in the solution folder.  Because the key was actually located in the project then the check in failed. 
 
I resolved this issue as removing the key as a solution item, infact I removed all solution items, and then attempted to check in the code.  This time the check in went successfully, thus as a word to the wise make sure your solution items are physically located in the solution folder and not referenced from sub projects.

Installing Visual Studio 2008

In January I attempted installing Visual Studion 2008 and always got an install failure when the Microsoft Visual Studio Web Authoring Component was being installed.  I found several postings on the Microsoft Support Site (http://support.microsoft.com).  After reading thoses posts here is what I have found:
  1. Uninstall ALL Beta everything
    1. SDKs
    2. VS Add-Ons
    3. Development…whatever
  2. Uninstall Microsoft Windows SDK 6
  3. Reboot and attempt VS2008 installation again

I also uninstalled Sharepoint Designer, as I have seen issues with this before, but it does not appear that this is not an issue/problem source.  Several of my coworkers who had similar experiences were able to install VS2008 without removing Sharepoint Designer so there is not need to worry about that.