A new release of Microsoft All-In-One Code Framework is available on May 16th.  We expect that its 11 new code samples covering typical programming scenarios in Windows Azure, .NET CLR, Windows SDK, Windows Forms, WPF, IIS and TFS would ease your development work.

imageYou can download the code samples using Sample Browser or Sample Browser Visual Studio extension. They give you the flexibility to search samples, download samples on demand, manage the downloaded samples in a centralized place, and automatically be notified about sample updates.

If it is the first time that you hear about Microsoft All-In-One Code Framework, please watch the introduction video on Microsoft Showcase, or read the introduction on our homepage http://1code.codeplex.com/.

 

----------------------------------------------------------------

New Windows Azure Code Samples

Increase ASP.NET temp folder size in Windows Azure

Download: http://code.msdn.microsoft.com/CSAzureIncreaseTempFolderSi-d58c604d

The sample was written by Microsoft Escalation Engineer Narahari Dogiparthi. By default the ASP.NET temporary folder size in a Windows Azure web role is limited to 100 MB. This is sufficient for the vast majority of applications, but some applications may require more storage space for temporary files. In particular this will happen for very large applications which generate a lot of dynamically generated code, or applications which use controls that make use of the temporary folder such as the standard FileUpload control. If you are encountering the problem of running out of temporary folder space you will get error messages such as OutOfMemoryException or ‘There is not enough space on the disk.’.

 

Add registry entries to VMs in Windows Azure

Download: http://code.msdn.microsoft.com/CSAzureAddRegistryKeysToVMs-75edd269

The sample was written by Microsoft Escalation Engineer Narahari Dogiparthi.  One of the common asks from developers is the ability to write to registry in Windows Azure. Startup tasks in Windows Azure can help you write to registry.  This sample code will add the registry keys to Azure VM's.

 

Enable static compression in Azure

Download: http://code.msdn.microsoft.com/CSAzureEnableCompression-9f4d9b73

Static compression is the feature that is shipped out of the box in IIS. Using static compression, developers/administrators can enable faster downloads of their web site static content like javascripts, text files, Microsoft office documents, html/htm files, cs files, etc.  So, how can we make use of this feature when hosting the web application in Windows Azure? By default static compression is enabled in Windows Azure, however, there are only few mime types that will be compressed. This sample demonstrates adding new mime types for static compression.

The sample was written by Microsoft Escalation Engineer Narahari Dogiparthi

 

Add firewall rules to VM’s running in Windows Azure

Download: http://code.msdn.microsoft.com/CSAzureAddFirewallRules-352de4ed

One of the common asks from developers is the ability to add firewall rules to Windows Azure Compute instances. Startup tasks in Windows Azure can help you add firewall rules.  This sample code will add few sample firewall rules to Azure VM's.

The sample was written by Microsoft Escalation Engineer Narahari Dogiparthi.

 

--------------------------------------------------------

New .NET CLR Code Samples

 

Merge the Config file for Referenced Managed DLL

Download: http://code.msdn.microsoft.com/CSMergeConfig-6e731d92

The sample is created by Microsoft Tech Lead: Ganesh Shankaran.

This program is a generic sample for a scenario where the config file of the dll needs to be merged with the Console application so that the Configuration of the class library (contains reference to service) can be accessed during application run to initialize the class.

Purpose of the sample:  Merging the configuration file for a referenced managed dll with the console application such that the Specified Section from the config file of Class Library will be merged with the console application.
 
Why do we need to merge the config file?  By default, only the config file of the executable will be accessed during runtime. If we need to load a class Library that has a service reference, the respective dll.config file cannot be accessed which will result in a System.Reflection.TargetInvocationException. So, to avoid there has been lot of request from our customers to provide a way to merge the config file such that we will be able to access the config file of the application and still be able to initialize.

 

--------------------------------------------------------

New Windows SDK Code Samples

Shut down a computer using .NET

Download: http://code.msdn.microsoft.com/CSShutdownComputer-b2cfbc74 

image

The sample was written by Microsoft engineer: Nibu Babu Thomas.

The application demonstrates how to shut down a computer using .net. I’ve pinvoked the native API’s to get this going. Following are the API’s implemented…

  1. ExitWindowsEx
  2. InitiateShutdown
  3. InitiateSystemShutdownEx
  4. AbortSystemShutdown

 

------------------------------------------------------

New Windows Forms Code Samples

 

Customize Windows Forms app's System Menu

Download: http://code.msdn.microsoft.com/CSCustomizeSysMenu-024ccb7f

The sample was written by Microsoft engineer Nibu Babu Thomas.  This application demonstrates how to modify a WinForms application’s system menu.   This is how the application looks like…

image

 

-------------------------------------------------------

New WPF Samples

 

Define and Access Shared Resources in WPF Class Library

Download: http://code.msdn.microsoft.com/CSWPFSharedResources-4d5f6e2a

The sample is written by Microsoft engineer: Shiva N Shankar.  It demonstrates the approach of

  1. Defining and using shared resources in WPF class library.
  2. Accessing shared resources using markup extension.

Normally in a WPF class library the resources used in the controls will not be reflected at the design time. This approach of combining the shared resources along with markup extension helps us to overcome this limitation.

image

 

-----------------------------------------------------

New IIS Code Samples

 

Set IIS Web Virtual Directory Properties

Download: http://code.msdn.microsoft.com/CSSetIISWebVirtualDirProper-cbe2c622

The sample is written by Microsoft Support Escalation Engineer Shaleen Thapa  It demonstrates how to set the Application name and Path on Virtual Directory tab (Properties) in IIS 6 programmatically. We are using here System.DirectoryServices namespace. This namespace is used to manage Directory Services using ADSI, Active Directory Services Interface.  This ADSI Interface has the interfaces for IIS metabase.
 
However, you cannot perform the following tasks unless you are using Windows XP Professional with Service Pack 2 or Windows Server 2003 with Service Pack 1. Doing so results in errors like "The directory cannot report the number of properties":

  • Enumerating through a collection of properties
  • Setting binary properties
  • Adding entries to a property collection
  • Deleting entries from a property collection
  • Moving or copying metabase nodes
  • Configuring MIME types or IP security properties

 

-----------------------------------------------------

New TFS Code Samples

 

Custom Data Grid work item control of Visual Studio

Downloads
C# version:  http://code.msdn.microsoft.com/CSTFSWorkitemDataGridView-2c27f82b
VB version: http://code.msdn.microsoft.com/VBTFSWorkitemDataGridView-cf1ac9b0

The sample was created by our star developer: Ruiz Yi.  It demonstrates how to create a Custom Data Grid work item control of Visual Studio.

  1. Display a Field value in DataGrid
  2. Save the data in DataGrid to a WorkItem Field
  3. Support customize the Columns' Name
  4. Avoid  Illegal characters

image

 

Custom DataGrid Control for WebAccess

Downloads
C# version: http://code.msdn.microsoft.com/CSTFSWebAccessWorkItemDataG-c4cdf62b
VB version: http://code.msdn.microsoft.com/VBTFSWebAccessWorkItemDataG-fa3fa520

The sample was created by our star developer: Ruiz Yi.  It demonstrates how to create a Custom Data Grid work item control of TFS2010 WebAccess.

  1. Display a Field value in DataGrid
  2. Save the data in DataGrid to a WorkItem Field
  3. Support customize the Columns' Name
  4. Avoid  Illegal characters

NOTE: The client javsscript uses Microsoft.XMLDOM to parse the xml, and it only works for IE.

image

If you have any feedback, please fill out this quick survey or email us: onecode@microsoft.com