Public Key Token from signed assembly

This is something I stumbled upon recently and most of you already have this option already in their tools menu in VS. this post is especially to those that just like me did not know it.

While developping a custom layouts page, you need to specify the assembly name where the asp page his code behind class can be found.

something like: Namespace, Version=,Culture=neutral, PublicKeyToken=****************

To retrieve this token you could drag and drop your assembly in the gac and copy the token from there. Sn.exe combined with external tool in visual studio offers you a simple menu that displays the public key token of the current signed assembly in no time.

In Visual Studio 2005, click Tools -> External Tools…
Click Add and enter the following into the different fields as displayed in the following screenshot:
Title: Get Public Key
Command: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sn.exe
Arguments: -Tp “$(TargetPath)”
Uncheck all options, except Use Output window\

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

AfterProperties.PercentCompleted: Input string was not in correct format.

A small tip while using the OntaskChanged activity, if you want to check if the assigned has completed his task don't use the AfterProperties.PercentComplete property .

Problematic situation:
A user modifies the task and the OntaskChanged_Invoked eventhandler is triggered. In this eventhandler the system checks is the user completed the task by setting the PercentCompleted formfield.
When the user doesn't uses the PercentCompleted field, but he uses the Status field. The workflow will crash because the code that is written behind the PercentComplete property of the AfterProperties object uses the StringToNumber(…) method.

//This will crash if the user leaves percentcomplete empty
string perComp = AfterProperties.PercentComplete;

AfterProperties contains a hashtable called ExtendedProperties, this hashtable has a guid as key(these guids can be found here ) and the current value as a string.By using this hashtable the system can first check if the Guid is available and if the stringvalue is valid.

//Get the percentcompleted value of the task by using the hashtable   
string perComp = AfterProperties.ExtendedProperties(Microsoft.SharePoint.SPbuiltInFieldId.PercentComplete);

You should also check if the user didn't use the status combobox to set his task as completed.

//Get the status value of the task by using the hashtable
string status= AfterProperties.ExtendedProperties(Microsoft.SharePoint.SPbuiltInFieldId.TaskStatus);
if(status == "Completed"){
VN:F [1.9.22_1171]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

My Recorded Session : Community day 2009

It was the first time that I had the chance to speak in front of a large audience (a filled movie theatre). Several weeks later, it is very confronting to hear yourself searching for the words that you have been rehearsing over and over again…

Get Microsoft Silverlight

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)