Paul Liebrand’s Weblog

Welcome to my blog mainly about SharePoint

SharePoint Development to BIN folder and extremely slow initial render times – Solution!

My fellow co-workers and I have been dealing with an extremely slow build > render process when we are developing SharePoint solutions that are deployed to the BIN folder for over a year now.

We are all using are own Windows Server 2003 image hosted on a VMware ESX Server farm with tons of other VM’s.

We all know that SharePoint can take anywhere from 30 seconds to 2 minutes to fire up the very first time you hit it and we accept that fact. However, we found ourselves waiting for up to 1 minute after making some code changes and perform a build that deployed the DLL to the BIN folder for SharePoint to render.

This can become extremely frustrating and frankly a waste of our time. I had gotten to a point where I just accepted the fact we had to deal with the slowness because no amount of tweaking we did on the VM (adding memory, CPU, etc) seemed to make a difference.

One of my co-workers did not want to accept the fact continued to investigate/troubleshoot the issue. He happened to come across the Understanding ASP.NET Dynamic Compilation (http://msdn.microsoft.com/en-us/library/ms366723.aspx) article, more specifically the section called Optimizing Dynamic Compilation. This section mentions an attribute you can add to your web.config file called optimizeCompilations which requires you to install a hot fix (KB961884). This attribute is going to be part of the .NET Framework 4.0 when it ships.

We were all amazed at the difference this attribute made to our development process. In one instance, it cut the time from 1 minute 10 seconds to 12 seconds (80% improvement!!).

The following screenshot shows the change in time with the attribute set to false and then set to true (fairly vanilla SharePoint application). The WebTimer utility just makes a simple web request to my SharePoint site.

OptimizeCompilation

Here is the order events described above:

  1. optimzedCompilations attribute in web.config was set to “false”
  2. Performed IISRESET to baseline
  3. Executed WebTimer (40 seconds)
  4. Modified some code in my solution and performed a build (which went into the BIN folder)
  5. Executed WebTimer (30 seconds)
  6. Switched optimizedCompilations to “true”
  7. Performed IISRESET to baseline
  8. Executed WebTimer (40 seconds)
  9. Modified some code in my solution and performed a build
  10. Executed WebTimer (12 seconds)

Needless to say, we have happy developers again! 

You may or may not see much advantage to this if you are developing on a physical machine or on a workstation edition of a virtual client (VPC, VMware Workstation, or Virtual Box). But if you are running in an environment where the resources are being shared or you feel your build to render process seems slower than it should be, I highly recommend you try this hot fix / attribute out.

Advertisements

September 18, 2009 Posted by | SharePoint | , , | 2 Comments

SharePoint URL Shortener – Feature Highlight

There is a feature in my SharePoint URL Shortener solution that was not included in the video I posted on YouTube recently. I thought I would take the time to spotlight this feature because it may not be too obvious.

The video highlights the ability to generate a short URL by using the drop down menu from within a list or library, for example:

ShortUrlLibrary

However, sometimes you may have the need to shorten the current URL you are on within a SharePoint site (it does not have to be a list item or document). My SharePoint URL Shortener adds a link to the Welcome menu located in the top right corner of the screen that when clicked will generate a short version of whatever URL you are currently viewing.

Lets say you wanted to create a survey and send it out to your users. You can now click on the Respond to this Survey button:

ResponseSurvey

Which will take you to some awful long URL which you would generally copy and paste into an email, or a SharePoint announcement and send out to your users.

With SharePoint URL Shortener, you can now click the drop down on the Welcome menu and select Generate Short URL and it will generate the short URL version:

WelcomeMenu

You can now include this shortened URL in an email message or post it to an announcement list within SharePoint.

ShortURLEmail

I hope you find this useful.

Thank you

September 1, 2009 Posted by | SharePoint | , , , | 1 Comment

SharePoint URL Shortener Codeplex site has been published and is live!

The SharePoint URL Shortener Codeplex site has been published and is now publically available (as promised from yesterdays post).

LiebrandUrlShortener

As a reminder, the URL is http://spurlshortener.codeplex.com.

If you have any problems, please post something on the Codeplex site and/or hit me up on Twitter (@PaulLiebrand).

Thank you and please be gentle!

August 29, 2009 Posted by | SharePoint | , , | 3 Comments

SharePoint Url Shortener – it’s finally here!

After many iterations and delays I am pleased to announce that my SharePoint Url Shortener (initial version) is finally here! There is still some work to be done on this but I have decided to release it in its current state to start getting some feedback from the community.

Here is a demonstration of the process – from feature activation to Url generation:

I’ll be publishing the Codeplex project sometime this weekend (probably Saturday) so be on the look out.

The Codeplex Url is http://spurlshortener.codeplex.com – I’ll update my blog and send out a notification on Twitter (@PaulLiebrand) when I actually pull the trigger.

Thank you for being patient and I hope you find this useful.

August 28, 2009 Posted by | SharePoint | , , | 2 Comments

“TinyUrl” for SharePoint Feature Requests

[Update – 9/2/2009]

I have released the first public version of my SharePoint URL Shortener. Please read the following blog posts for more information:

https://liebrand.wordpress.com/2009/08/28/sharepoint-url-shortener-its-finally-here/

https://liebrand.wordpress.com/2009/08/29/sharepoint-url-shortener-codeplex-site-has-been-published-and-is-live/

https://liebrand.wordpress.com/2009/09/01/sharepoint-url-shortener-feature-highlight/

I am soliciting feature requests on Twitter for the first version of the “TinyUrl” for SharePoint feature I’ll am developing.

If you do not want to post them to Twitter, feel free to post them in the comments of this post.

March 3, 2009 Posted by | SharePoint | , , , | 2 Comments

Article on SharePointMagazine.net – Introduction to SharePoint Feature Stapling – Part 2

The second part of my article, Introduction to SharePoint Feature Stapling – Part 2, has been posted on http://www.SharePointMagazine.net. Hopefully you find this information useful.

Please check it out of you have a free moment.

November 6, 2008 Posted by | SharePoint | , , | Leave a comment

Useful SharePoint Utilities

A recent update to one of the utilities I use on a regular basis prompted me to write this post which I have been wanting to do for a long time.

Carsten Keutmann develops SharePoint utilities that I consider essential to my administration / development toolkit. The utilities I am talking about is SharePoint Manager 2007 and WSPBuilder.

If you have not checked these out yet – definitely give them a try. Well worth your time.

Keep up the good work Carsten!

October 3, 2008 Posted by | SharePoint, Tools | , , , | 1 Comment

Updated: "TinyUrl" like feature for SharePoint

[Updated – 8/30/2009]

For those of you who have not seen it yet, my SharePoint URL Shortener has been released.  Please see the following posts for more information:

https://liebrand.wordpress.com/2009/08/28/sharepoint-url-shortener-its-finally-here/

https://liebrand.wordpress.com/2009/08/29/sharepoint-url-shortener-codeplex-site-has-been-published-and-is-live/

[Updated – 4/13/2009]

As you have probably seen by now I was unable to get the TinyUrl like feature for SharePoint posted by my self imposed date. At this point I am not sure when I’ll get it posted – rest assure, it is coming.

[Updated – 4/2/2009]

For those who missed my Twitter the other day – My current plan is to release the first version of this feature to CodePlex on 4/12/2009 (perhaps sooner). I’ll let you know if this changes.

 

I have been working on a proof of concept idea to attempt to shorten the URLs that appear in SharePoint. Anyone using SharePoint knows that the URLs can get extremely long and sometimes can be be overwhelming to end-users who have a need to copy and paste them in emails for example.

This feature is not quite complete yet but I thought I would post about it as an early preview.

The basic premise of this feature is to use URL Rewriting, a mechanism to generate a short uniquely ID, and a SharePoint list to store them in.

1. Activating the feature:

image001

2. Navigate to a document library and click the Actions button, or the drop down on a document and select Get ShortUrl

image003

3. You will be redirected to a page that displays the new ShortUrl and it will also automatically copy it to the clipboard:

image005

As you can see the URL generated is http://server/ShortUrl/3V. This URL can now be included in emails, bookmarks, etc and it will always be a direct link to this document.

Even if more than one person selects the Get ShortUrl option on this document, it will always retrieve the same ID.

Stay tuned — I’ll have a downloadable version, instructions, and source available soon.

Thoughts?

September 8, 2008 Posted by | SharePoint | , , | 27 Comments

Article on SharePointMagazine.net – Introduction to SharePoint Feature Stapling

The first part of my article, Introduction to SharePoint Feature Stapling, has been published.

Give it a read if you have a moment.

August 18, 2008 Posted by | SharePoint | , , | Leave a comment

CustomAction, NewMenu and mysterious blank control

As many SharePoint developers know the toolbars are very customizable via features. However, if you ever tried to add a custom control too the NewMenu you may have been plagued by the mysterious blank control:

NewMenuMissing

The elements.xml of this feature looks like this:

   1: <CustomAction GroupId="NewMenu"
   2:               Location="Microsoft.SharePoint.StandardMenu"
   3:               ControlAssembly="NewMenuSample, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9860eb616e81cf1b"
   4:               ControlClass="NewMenuSample.SampleNewMenuItem"
   5:               RegistrationId="101"
   6:               RegistrationType="List"
   7:               >
   8: </CustomAction>

And the actual code for the sample is pretty straightforward:

   1: using System;
   2: using System.Web.UI.WebControls;
   3: using Microsoft.SharePoint.WebControls;
   4: 
   5: namespace NewMenuSample
   6: {
   7:     public class SampleNewMenuItem : WebControl
   8:     {
   9:         protected override void CreateChildControls()
  10:         {
  11:             MenuItemTemplate menu = new MenuItemTemplate();
  12:             menu.ID = "SampleMenu";
  13:             menu.Text = "Menu Item 1";
  14:             menu.Description = "Menu Item 1 Description";
  15: 
  16:             this.Controls.Add(menu);
  17:         }
  18:     }
  19: }

It turns out that the problem lies in the CSS style being applied to the the elements causing the NewMenu items to be wrapped in a <SPAN> tag.

You can resolve this issue by simply adding the following to your class:

   1: protected override void Render(System.Web.UI.HtmlTextWriter writer)
   2: {
   3:     RenderChildren(writer);
   4: }

And then your custom menu item will start working as expected:

FullMenu

Thank you to Pascal Van Vlaenderen for the information on this.

July 14, 2008 Posted by | SharePoint | | 6 Comments